Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Biometric Prompt is not dismissed when device home button is pressed

When Biometric prompt is shown in App with setDeviceCredentialAllowed(true), It is not dismissed when device home button is pressed. It throws BiometricPrompt.ERROR_USER_CANCELED error and keeps the System UI as is.

Did any one face this issue ? Is there any workaround kind of thing ?

Note : I am using androidx.biometric:biometric:1.0.1

Note: Its Android bug. https://issuetracker.google.com/issues/149770989

like image 897
Shanker Avatar asked Feb 19 '20 09:02

Shanker


People also ask

What is biometric prompt in Android?

public class BiometricPrompt. A class that manages a system-provided biometric prompt. On devices running Android 9.0 (API 28) and above, this will show a system-provided authentication prompt, using one of the device's supported biometric modalities (fingerprint, iris, face, etc).

How do I know if my Android has Biometrics?

To check whether biometric authentication is supported on a device, use BiometricsManager. canAuthenticate() . This call returns a success flag when the device has available biometric hardware, and the user has a biometric enrolled on the device.

How can I make my BiometricPrompt non cancelable?

setCancelable(false) .


1 Answers

I found this bug when I tried this library. The problem is they implemented it as a fragment, and it's not responding well to this thing.

I opted out of using this library all together and just implemented it myself.

like image 132
Lena Bru Avatar answered Nov 15 '22 07:11

Lena Bru