1

Is there any way to get a list of biometric sensors which are already configured in the device.
For example if there are all sensors configured like;

  • iris
  • fingerprint
  • face

I find all 3, but if any one of the 3 is configured, I want to get the one configured e.g. fingerprint

I have searched the docs but didn't find any clues other than we will get one but which one is never mentioned.
Any solution to solve the above problem would be very helpful.

For my curiosity why can't android provide the configured sensors, like we get when we require runtime permission?

Secondly how they prioritize the sensors if all 3 are configured?

moken
  • 3,227
  • 8
  • 13
  • 23
sandeep dhami
  • 188
  • 1
  • 10
  • Unfortunately, when you use `BiometricPrompt` you have no control over which kind of biometric that will be used. Well, in Android R you can select whether or not you want to allow "Weak" biometrics (as defined in the Android CDD), but you can't specify fingerprint or face for example. – Michael May 07 '20 at 10:16
  • _"how they prioritize the sensors if all 3 are configured"_ AFAIK, if the device supports multiple biometrics (e.g. both fingerprint and face), there'll be some kind of setting in the Settings app where the user can select their preferred biometric. – Michael May 07 '20 at 10:17
  • So does it depends on the device as when I use S10 (Pie) I can able to authenticate face and Biometric prompt is also showing with all details like title, description, etc but in OnePlus 6T(Pie) neither face authentication is working nor Biometric prompt is showing with provided details. – sandeep dhami May 07 '20 at 10:58

1 Answers1

1

You can find the available sensors in the PackageManager, but please note that face recognition and iris were added in Android 10.

val packageManager = context?.packageManager
if (packageManager?.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT) == true) {
        Toast.make(context, "Fingerprint sensor found!", Toast.LENGTH_SHORT).show()
    }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
    if (packageManager?.hasSystemFeature(PackageManager.FEATURE_FACE) == true) {
        Toast.make(context, "Face sensor found!", Toast.LENGTH_SHORT).show()
    }
    if (packageManager?.hasSystemFeature(PackageManager.FEATURE_IRIS) == true) {
        Toast.make(context, "Iris sensor found!", Toast.LENGTH_SHORT).show()
    }
}
N. Park
  • 387
  • 4
  • 14