I need to integrate Biometric authentication using Fingerprint and Face authentication. Fingerprint authentication works perfectly but when I set only Face authentication I am getting Biometric not enrolled response from BiometricManager.from(context) method as follows,
val biometricManager = BiometricManager.from(context)
when(biometricManager.canAuthenticate()){
BiometricManager.BIOMETRIC_SUCCESS ->{
Log.e(TAG, "App can authenticate using biometrics.")
}
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE ->{
Log.d(TAG, "Hardware not available")
}
BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE ->{
Log.d(TAG, "Biometric features are currently unavailable.")
}
BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED ->{
Log.d(TAG, "The user hasn't associated any biometric credentials with their account.")
}
else ->{
Log.d(TAG, "Nothing supported")
}
}
Android Biometric APIs would only work on the devices which have their biometric features (face,fingerprint, iris) compatible with Android Biometric stack. I have a set of devices with Face feature support, among them only few support Android Biometrics.
After looking at all the hurdles implementing the biometric for Android, I have chosen not to use BiometricManager.from(context) method to check if Biometric authentication is enabled, instead of that checked if KEYGUARD_SERVICE is enabled and used following prompt info
BiometricPrompt.PromptInfo.Builder().apply {
setTitle(getString(R.string.title))
setSubtitle(getString(R.string.sub_title))
setConfirmationRequired(true)
setDeviceCredentialAllowed(true)
}.build()
through which even if only face ID is set and is not supporting the current callbacks, application fallbacks to devices PIN authentication method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With