问题
In Android 10 devices, Biometric prompt is failing with BiometricPrompt.ERROR_CANCELED
all the time on top of the lock screen. Error is returned in onAuthenticationError
callback of BiometricPrompt.AuthenticationCallback
class.
The biometric prompt authentication is working when the device is unlocked.
is it possible to have biometric prompt authentication done on top of device lock screen in Android 10 when setDeviceCredentialAllowed is set to true?
Update: The issue is only when setDeviceCredentialAllowed is set to true. i.e if Devicekeyguard is made as fallback in BiometricPrompt , the authentication is not working on top of lock screen.
回答1:
An answer has been provided for this issue on the official tracker. Here is the gist as stated there as well:
This is a side effect of launching on lockscreen, and is a known issue. Whenever an activity is allowed over lockscreen, it goes thorugh the lifecycle twice. In this case, since the first one went onPause, SystemServer stopped the authentication session.
This has been fixed in Android11, SysUI handles all of the authentication lifecycle now.
来源:https://stackoverflow.com/questions/59044309/in-android-10-devices-biometric-prompt-is-failing-with-error-canceled-all-the-t