0

I face an issue on Android 11 (API 30). The BiometricPrompt.AuthenticationCallback() is not triggered.

Step to reproduce:

  1. Show Biometric prompt
  2. Press the back key to make the dialog be dismissed and onAuthenticationError triggered.
  3. try to show the Biometric again.
  4. Press the back key again or provide the correct/wrong biometric. There is no authentication callback triggered.
val callback = object : BiometricPrompt.AuthenticationCallback() {

            override fun onAuthenticationError(errCode: Int, errString: CharSequence) {
                super.onAuthenticationError(errCode, errString)
                if (errCode == BiometricPrompt.ERROR_USER_CANCELED)
                    // user click outside or back key -> try to show biometric prompt again
            }

            override fun onAuthenticationFailed() {
                super.onAuthenticationFailed()
                processFailed()
            }

            override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
                super.onAuthenticationSucceeded(result)
            }
        }
        biometricPrompt = BiometricPrompt(activity, executor, callback)

        biometricPrompt.authenticate(promptInfo)

Expected: at least one of the AuthenticationCallback functions should be triggered. Does anyone have experience with it before (why the callbacks don't trigger on the 2nd biometric prompt? or is there any way to avoid the biometric prompt close in this scenario?

Note

  • I use androidx.biometric:biometric version 1.2.0-alpha01, I tried to update to the latest version, and the same issue still appears.
  • Only happens on Android 11.

Thank you in advance!

Tan174
  • 1
  • 1
  • I am using this latest version and tried following your steps on Android 12 Google Pixel 3 and do not face the issue you mentioned it always gives me call back return on onAuthenticationError. – Malik Saifullah Jul 20 '22 at 07:53
  • Thank @MalikSaifullah for the response. I just checked on Android 11. Let me update the description and checked on Android 12 also. my bad. – Tan174 Jul 20 '22 at 08:11

0 Answers0