Reputation: 355
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")
}
}
Upvotes: 10
Views: 11696
Reputation: 449
I face the same issue while integrating it into my app When I use
biometricManager.canAuthenticate(BIOMETRIC_STRONG)
to check biometric is available in the device it return BIOMETRIC_ERROR_NONE_ENROLLED and as soon as I change the authentication mode to BIOMETRIC_WEEK
it work well I test on Samsung S9 and a few Other devices.
Currently is use this biometeric dependency hope it works for you
implementation "androidx.biometric:biometric-ktx:1.2.0-alpha03"
Upvotes: 2
Reputation: 182
Some of the facts I have found while I was working with it. This is based on Biometric API "implementation 'androidx.biometric:biometric:1.0.1'".
I have created reference POC for the community to help. The documentation hasn't provided good documentation on biometric change detection. This is pure kotlin code and also detects the biometric change and many functions such as does user enrolled in Bio, does device enroll in Bio, what type of biometric, is the user previously enrolled. Please take a look at this link.
Upvotes: 0
Reputation: 355
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.
Upvotes: 3
Reputation: 864
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.
Upvotes: 7