Start a Project

Fingerprint Authentication using BiometricPrompt

Fingerprint Authentication using BiometricPrompt

In this blog, we are going to learn about Fingerprint Authentication using BiometricPrompt.The Android Framework and Security team recently released the AndroidX Biometric Library, a support library that supersedes all previous iterations of the API.

The library makes all the features announced in Android 10 (API level 29) available all the way back to Android 6 (API level 23).

BiometricPropt UI : 

BiometricPropt provides there own stable UI and Dialogs. In the previous FingurePrint Manager, there is no option of the UI. There is only a custom view.

Android app integration :

Integrate this dependency to the build.gradle (app) file.

Check whether your device supports any biometric authentication. :

Firstly, You should create and biometricManager object.

Create an instance of BiometricPrompt:

In this paragraph, We are going to create a BiometricPropt object. Firstly, You should instantiate BiometricPrompt early in your Activity/Fragment lifecycle, preferably inside onCreate() or onCreateView(). This is a key difference between FingerprintManager and BiometricPrompt. It was OK to instantiate FingerprintManager just in time to call authenticate(). But for BiometricPrompt to send callbacks to the proper activity, say in case of configuration changes, you must instantiate it a bit before you need to call authenticate().

Create PrompInfo object to show the biometric prompt dialog :

Now you just need to call to authenticate method of biometriPrompt :

Fingerprint Authentication using BiometricPrompt :

Here we achieve this,

 

Exit mobile version