0

Testing for biometrics on a Pixel 4XL (Android Q) fails returning BIOMETRIC_ERROR_HW_UNAVAILABLE.

I have setup face recognition

Android manifest file

<uses-permission android:name="android.permission.USE_BIOMETRIC" />

gradle dependancies

dependencies {
    implementation "androidx.biometric:biometric:1.0.1"
}

Test code

private boolean setBIOSetup() {
    BiometricManager biometricManager = BiometricManager.from(getActivity());
    switch (biometricManager.canAuthenticate()) {
        case BiometricManager.BIOMETRIC_SUCCESS:
            return true; 
        case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
            Toast.makeText(getActivity(), "No biometric hardware installed", 
                           Toast.LENGTH_LONG).show(); 
         case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE: 
             Toast.makeText(getActivity(), "Biometric hardware unavailable.", 
                            Toast.LENGTH_LONG).show();
              break; 
         case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED: 
             Toast.makeText(getActivity(), "No biometrics enrolled", Toast.LENGTH_LONG).show(); 
             break;
    } 
    return false; 
}

On a Pixel 2XL it returns BIOMETRIC_SUCCESS for fingerprint biometrics but for Pixel 4XL it returns BIOMETRIC_ERROR_HW_UNAVAILABLE.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
glen
  • 9
  • 2

1 Answers1

1

The Pixel 4 and 4 XL do not feature any finger-print sensor, but only face-unlock.

You've already filed a bug filed against the library, see issue #146978096
and you should follow their suggestion to run adb bugreport foo.zip.

BiometricManager .canAuthenticate() at least states the three prerequisites:

Determines if biometrics can be used, or equivalently, whether BiometricPrompt can be shown.

  • hardware available
  • templates enrolled
  • user-enabled

If it's indeed a bug, you'll have to wait until androidx.biometric:biometric:1.0.2 was released.

Community
  • 1
  • 1
Martin Zeitler
  • 1
  • 19
  • 155
  • 216