Ever since the digital way of life became mainstream, human beings, in general, have reaped plenty of benefits. The convenience and the seamlessness of being able to do myriad things from home have made life easy. However, this has not been without its own set of issues, one of which is security. Thankfully, the thing about technology is that it has a solution to pretty much everything and to cut a long story short, that's why biometric authentication is such a rage in the world right now.

So, if you, too, are considering integrating such a provision for your Xamarin mobile apps, you have come to just the right place.

Now let's get straight to business and move on to how you can integrate biometric authentication in iOS and Android. Before we delve into the individual steps required for the two OS, you will first need to create a brand new Xamarin.Forms project in Visual Studio and then update all the NuGet packages. Once that is done, you need to install the Plugin.Fingerprint library.

These were the simple steps; time to examine the individual steps for iOS and Android now.

1. iOS:

This one is rather simple because programmers are required to do pretty just one thing, i.e., add a usage description in the Info.plist file. It will enable the library to handle FaceID on iOS version 11.3 and higher. Once that is done, you can now move on to the other steps in the process.

The following is a code snippet for how you can get started with biometric authentication in iOS.

<?xml version="1.0" encoding="utf-8" ?>

2. Android:

The process with Android is comparatively more complicated; you will need to start with installing Xamarin.AndroidX.Migration NuGet packages. After this is done, it is now time to edit the app manifest, and first, add the lowest compatible version as Android 6.0. And you will also need to enable 'USE_FINGERPRINT' in the 'Required Permissions' box on the Android app manifest edit page. Then make sure the current activity instance is assigned to the library's resolver.

protected override void OnCreate(Bundle savedInstanceState)

{

CrossFingerprint.SetCurrentActivityResolver(() => this);

TabLayoutResource = Resource.Layout.Tabbar;

ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(savedInstanceState);

Xamarin.Essentials.Platform.Init(this, savedInstanceState);

global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

LoadApplication(new App());

}

Xamarin mobile apps stand to be fortified substantially when biometric authentication methods such as fingerprint authentication and FaceID. These methods are rendered particularly important in consideration of the sensitive data that is typically stored on our mobile phones now. And don't worry if it seems complex for expert assistance can always be acquired.

Author's Bio: 

Kaushal Shah manages digital marketing communications for the enterprise technology services provided by Rishabh Software.