Search code examples
androidandroidxandroid-biometric-prompt

How to make BiometricPrompt non-cancelable?


I am using BiometricPrompt in my application. It works well and shows the dialog when call the authenticate() method. But this dialog gets closing when I click outside the dialog. How to prevent it? How to make BiometricPrompt's dialog non-cancelable? Here is no method like biometricPrompt.setCancelable(false).


Solution

  • You have to use the version 1.0.0-beta01 or later.

    Now it is the default behavior:
    Touches outside no longer cancel authentication. Back button cancel authentication still.

    You can see the changelog:

    Changed behavior to not allow BiometricPrompt to be cancelled by a touch event outside the prompt.

    You can check also the rewiew report.
    No new API.