LocalAuthentication retry in Android

I’m using LocalAuthentication for integrating biometric authentication means in my app. As it’s noted in the documentation, Android does not provide any UI to deal with the biometric authentication process. Expo teams little UI example is great to start with. There the Modal component has onshow event which is tied to the scanFingerprint function. I’ve tried to enable retry without having to close the modal and bring it back again. For that, I call the scanFingerprint function recursively in case of unsuccess unless the maximum number of retries is reached. But for some reason LocalAuthentication.authenticateAsync functions returns false immediately, without letting me really swipe my finger. Has any of you been able to achieve this?

I’ve just found out that in Android there’s roughly a 5 trials per 30 seconds of false scan rule. So, after you’ve reached the maximum dictated by the OS you get rejected immediately. That’s why it doesn’t even wait for you to scan your fingerprint and returns false for the success prop of the returned object. You can read about that rule in this Android compatibility document

1 Like