Read More

Android Biometric Api

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.

 

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close