I integrate Biometric authentication using Fingerprint, Face, and device credentials (PIN/PASSCODE/PATTERN). But I got the issue with face authentication when using device credentials. it happens on some devices.
When I integrate Fingerprint, Face, and device credentials. The biometric popup just only detects Fingerprint and has a button to move to device credentials. The option for face authentication should be displayed.
If I integrate Face and device credentials. The biometric popup is ignored, and its moves to the screen for input device credentials automatically. In this case, the popup should be displayed and user can authenticate with their face or move to use device credentials with a button if they want.
If I integrate fingerprint or face or both without device credentials. Everything works well.
This is my code with device credentials:
@Suppress("DEPRECATION")
fun createPromptInfo(activity: AppCompatActivity): BiometricPrompt.PromptInfo =
BiometricPrompt.PromptInfo.Builder().apply {
setTitle(activity.getString(R.string.title)
setSubtitle(activity.getString(R.string.subtitle))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
setAllowedAuthenticators(
BiometricManager.Authenticators.BIOMETRIC_STRONG or
BiometricManager.Authenticators.BIOMETRIC_WEAK or
BiometricManager.Authenticators.DEVICE_CREDENTIAL
)
} else {
setDeviceCredentialAllowed(true)
}
setConfirmationRequired(false)
}.build()
I face this issue on Samsung A30s and Samsung A31 (both's OS is Android 10). But when I test on Samsung M33 (Android 12), everything is good, it doesn't have this issue.