Showing posts with label Xamarin. Show all posts
Showing posts with label Xamarin. Show all posts

Payment gateway integration in Xamarin Form .Net MAUI using RazorPay

Brief: In this post we can see how to integrate payment gateway using RazorPay in Xamarin form for iOS and Android.




Description: 

Right now i'm seeing very limited support for Xamarin with payment SDK from the top payment gateway providers like Stripe,RazorPay,PayU,JustPay. Few are providing the SDK but that is outdated and not supporting in the latest version. 

Android Keystore based Encryption and Decryption in Xamarin Android

Brief Walkthrough on Android Keystore based app security in Xamarin android

Description
Data security should be considered as  top priority in any application and this is not just for password any sensitive data, app internal files including the database file. Any security breach in app secret data or app unique concepts(USP) can make way to competitors/attackers.  There are plenty of approaches one can choose to secure app private data.

Why Android Keystore based security : In general in any data encryption/decryption we need to provide the public/private keys. here the challenge is how we can secure these keys. Keystore based security provides solution for this issue where it generates and maintains the key dynamically. 

Dependency injection in xamarin form using AutoFac

Brief: Here we will learn how to add constructor Dependency Injection in xamarin.form using AutoFac

What is Dependency injection?
Before getting into any definition let us look into a simple example, For xamarin form application
whenever we need to get the native functionalities ( Check internet connectivity, Location,Camera
and any device details etc) Dependency injection is the best way to get the solution.


In below example shown how to launch phone dialer from xamarin form project. 

ReOrder the list items by drag and drop in xamarin android using RecyclerView

Brief:  Explanation with simple steps to how to re-order the list items by long press, drag and drop using recycler view in xamarin android.
  



Image Gallery Control using Xamarin Form

Brief: Implementation of Custom gallery control for Xamarin Form explained in a simple steps.


Description: If you have a plan to display image in gallery or in grid format for your Xamarin.Form application then you are in right place now.
You should be able to do so in next 15-20 minutes :). This implementation targets both android and iOS. Now quickly go through with steps.

Bug : Java.Lang.NullPointerException,Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isMutable()' on a null object reference

I have observed this above mentioned bug keeps on hitting when using Xamarin form,UI control "Frame" for android while it executes without any issues for iOS. 

In my previous post discussed about Frame border highlight issues in android. Frame control still has one or other problem with android and still remains a question mark why Xamarin team has not given any fix for this android specific problem.

How to fetch android sqlite db file from device in Mac Xamarin/Visul Studio.

Here i'm going to share one of the simple method to fetch sqlite database file from android device for xamarin or visul studio installed in mac machine. 
Recently when i was checking data stored in the sqlite db from android device, i couldn't do it easily as i fail to run ADB commands from my terminal.

Same if you are fetching DB file from Emulator it is pretty straight forward. 
Launch Device Monitor(Tools-> Device Monitor) 
select Emulator from left pane
select File Explorer from right pane 
Navigate to app data base file-> /data/data/com.appName.MyApp/databases/
Select required database file->"Pull a file from device" option from top right as shown in screen
Copy DB file to machine storage and open using sqlite db browser(http://sqlitebrowser.org/)

To fetch DB from android device using Windows machine we can use the following ADB command

Platform specific UI changes in Xamarin.Form


Brief: Walkthrough on the options available in xamarin form for changing UI element behaviour for specific platform.

Description: Xamarin form wrapper UI controls when it renders in each platform shows the native look and feel but still there are some quirks that has to be worked around to get the UI perfection.

For example if i add one label in my xamal page and on run in android and iOS shows the below output:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:CodeLog" x:Class="CodeLog.CodeLogPage">
<RelativeLayout HorizontalOptions="FillAndExpand"  >
    <Label Text="Code Log" 
          FontSize="25" 
          FontFamily="Roboto-Bold" 
          HorizontalTextAlignment="Center" 
   HorizontalOptions="FillAndExpand" />  
</RelativeLayout>
</ContentPage>
In iOS label has been overlapped with toolbar. So alone for iOS we need add To padding(Tool bar height 20px).

This kind of changes for particular platform can be achieved by using the below mentioned approaches without using the Custom renderer.

1.Using a generic class OnPlatform
2.PlatformConfiguration(https://blog.xamarin.com/bringing-platform-specific-functionality-to-xamarin-forms-apps/)
3.Bindable Native Views in Xamal page (https://blog.xamarin.com/adding-bindable-native-views-directly-to-xaml/)
4.customisation with effects(https://blog.xamarin.com/customizing-xamarin-forms-controls-with-effects/)
In this article i will be making use of the OnPlatform for different UI control properties. From Xamarin.Forms version 2.3.4, Device.OnPlatform API has been deprecated with OnPlatform and On APIs.
 <?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:CodeLog" x:Class="CodeLog.CodeLogPage">
<RelativeLayout HorizontalOptions="FillAndExpand"  >
  <RelativeLayout.Margin>
    <OnPlatform x:TypeArguments="Thickness">
      <On Platform="iOS" Value="0,20,0,0" />
      <On Platform="Android, WinPhone, Windows" Value="0,0,0,0" />
    </OnPlatform>
  </RelativeLayout.Margin>
    <Label Text="Code Log" FontSize="25" FontFamily="Roboto-Bold" HorizontalTextAlignment="Center" 
  HorizontalOptions="FillAndExpand" />  
</RelativeLayout>
</ContentPage> 
Platform specific Text color:
 <Label Text="Code Log" FontSize="18" FontAttributes="Bold"  FontFamily="Roboto-Bold" XAlign="Center"  HorizontalTextAlignment="Center" 
 HorizontalOptions="FillAndExpand"
 RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"> 
  <Label.TextColor>
    <OnPlatform x:TypeArguments="Color" iOS="Red" Android="Blue"  />
     </Label.TextColor> 
   </Label>  

ResolveLibraryProjectImport task failed unexpectedly in release mode in xamarin

This above mentioned error i got during my xamarin form project deployment in release mode. 
In my solution i have more then one project and this error indicates that linking between these project has been broken. If you are facing the same issue, then here i have listed out few scenarios that could help you to solve this issue:


1. Select the project in which error is pointing and Check the reference of other project and package. Reference with yellow triangle icon shows the broken reference. just delete it and re-add.
For any other project reference included in the current project, delete the current project reference and add the new one from release folder of that respective project.
 Or
Open "Configuration manager"



Xamarin Form Frame outline color display issue in android

This is the quick glance on the issue i have faced during the use of Frame control in Xamarin form project and sharing here hoping that may helpful to somebody with the same issue.

Using Xamarin form Frame controls shows some strange behaviour in android platform where as it shows elegant look in iOS.
We can notice this difference in below screenshot.[Nexus S (KitKat) and Simulator iPhone6 iOS9.3]



     

Circular progress bar example using xamarin android

In brief: Here you can check the implementation of custom android widget called circular progress bar in steps using xamarin android.

ExpandableListView in xamarin android

Expandable List View is basically used to display the list of data with respective categories. Which has the feature to expand and collapse the items in a category when user touches category title.


Material design tab in xamarin android

Introduction: Here I'm adding one more UI component to Android Material Design introduction series i.e. Tab control using android material design library in xamarin android. 

Xamarin android material design Snackbar customization

Another beautiful component introduced with android material design is Snackbar. Which has the features similar like a Toast message in additional with interaction capability, displays at the bottom of the screen.


Push notification using Google Cloud Messaging(GCM) in Xamarin.Android

In Brief:
 This Post is regarding the implementation of Remote notification or Push notification using Google cloud messaging.



Custom AlertDialog example in Xamarin.Android

In Brief:
In this post i will discuss about one of the basic and most widely used component in an android development called customized alert dialog. There are several way of implementing it, here i will show custom alertDialog creation using "DialogFragment method" and "Layout inflation to AlertDialog".