6

I don't see anything related to being able to distinguish between different biometric authentications within the android.hardware.biometrics package.

I have found the FingerprintManagerCompat that has the hasEnrolledFingerprints() methods but I was wondering if it was the way to go as it seems from the documentation that we should rely on the android.hardware.biometrics package classes.

Any advice on that? Did I miss something?

grandouassou
  • 2,500
  • 3
  • 25
  • 60
  • 1
    Unfortunately that is currently not supported. I filed [an issue](https://issuetracker.google.com/issues/111315641) about that a little over a year ago, but I haven't really heard anything back from Google. – Michael Sep 05 '19 at 15:37
  • I'm stuck with the same issue, Did you find any solution? – KZoNE Mar 19 '20 at 07:57
  • 1
    @KZoNE There isn't. You either use deprecated APIs and then you can distinguish. Or you use the new Biometrics API and then you don't know the auth type. – grandouassou Mar 19 '20 at 15:16

4 Answers4

3

As of now we ideally cannot. Look into this : https://issuetracker.google.com/issues/111315641

Anubhav
  • 1,984
  • 22
  • 17
0

hasEnrolledFingerprints was depreceated in API 28.

It is now suggested to use BiometricPrompt and BiometricManager instead of FingerprintManagerCompat. This class allows for a seamless biometric UI across the device and allows for any kind of Biometric authentication provided by the OEM.

Where you might have called hasEnrolledFingerprints in the past to see if the user has fingerprints set up, the BiometricPrompt will throw an error specific to this.

Nathan K
  • 199
  • 7
  • 4
    Ok, but the error is generic. I need to know whether the user authenticates with fingerprint or face id or else. Because I only want to allow fingerprint and not the rest. – grandouassou Sep 05 '19 at 04:42
  • 1
    Also running into this issue. I'd like to direct the user slightly different if they need to use fingerprint vs. faceid. – Shayla Sawchenko Nov 15 '19 at 01:29
0

Use Android Biomatric Api

use the below method to identify Biomatric available or not

public int canAuthenticate () // api introduced android 29
John Ruban Singh
  • 1,284
  • 14
  • 19
  • 1
    Unfortunately, there is no specific way to identify FaceID authentication and Fingerprint authentication in API 29 as well. – KZoNE Mar 19 '20 at 08:00
0

This is by far, not a future-proof piece of code, but it might just get you out of the problem you're in. This may be what you need.

How to get list of available biometric sensors in an android device (any tweaks as documentation doesn't state any)

moken
  • 3,227
  • 8
  • 13
  • 23