Android Biometric Api

Updated 13 November 2019

Save

Android Biometric Api is part of the AndroidX Biometric Library for biometric authentication. We can check biometric sensor in device with the help of Biometric Api. It provides UI to developers. There is no need to create custom UI. It supports all type of biometric authentication in device.

NOTE: For Android Biometric Api, min support Android version is Android P.

Compare with previous provided authentication api ->

Android 6.0 (API level 23) introduced FingerprintManager. It is used only for fingerprint sensors. It doesn’t provide any UI to developers Developers needed to build their own fingerprint UI. In Android 9.0(P) FingerprintManager is deprecated. It releases a new API called BiometricPrompt.

BiometricPrompt

Use to manage system-provided biometric dialog.

Android App Integration

1. Add dependency in gradle

 

2. In your Activity/Fragment, check whether your device supports any biometric authentication.

3. Create a instance of BiometricPromptThe BiometricPrompt constructor needs 2 things ->

a. Executor -> specify a thread for callbacks

b. AutheticationCallback object -> object which has three methods

onAuthenticationSucceeded() -> called after successful login with biometric

onAuthenticationError() -> called when unrecoverable error occurs

onAuthenticationFailed() -> called when user is rejected.

4. Create prompt object to show biometric app.

 

5. Now, call authenticate function for biometric authentication

Example ->

 

To know more about Android Biometric Api, check following link -> Biometric

Hope, this blog is helpful for you.

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home