The Biometric Library is built to recognize the form factor that is present on the device. So if a device has the hardware for facial recognition then the library will recognize it. If a device only supports fingerprint, then the prompt will show fingerprint.
Have you checked the following?
- whether there is biometric (facial, in your case) hardware available on the device,
- whether the user has enrolled templates,
- whether the user has enabled biometric authentication.
Are you checking canAuthenticate()
?
override fun onClick(view: View) {
val promptInfo = createPromptInfo()
if (BiometricManager.from(context)
.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) {
biometricPrompt.authenticate(promptInfo, cryptoObject)
} else {
loginWithPassword()
}
}
What errors are you getting? The following blog posts may provide further guidance
- Using BiometricPrompt
- More details on using BiometricPrompt and migration