Question: I'm asked to show certain UI elements depending on the presence of biometric hardware. For Android 23-27 I use `FingerprintManager#isHardwareDetected()` and `FingerprintManager#hasEnrolledFingerprints()`. Both of which are deprecated in Android 28.

I understand that I can get this information by using `BiometricPrompt#authenticate(...)` and receiving either `BiometricPrompt#BIOMETRIC_ERROR_HW_NOT_PRESENT` or `BiometricPrompt#BIOMETRIC_ERROR_NO_BIOMETRICS` in the `BiometricPrompt.AuthenticationCallback#onAuthenticationError(int errorCode, ...)` method. But this would lead to the `BiometricPrompt` being shown on supporting devices, which is undesirable. Using the `CancellationSignal` doesn't seem to be a solution either, since I wouldn't know when to cancel the prompt.

Is there any way to detect biometric hardware presence and user enrolment?

Answer: 
Google finally solved this problem with Android Q

The [android.hardware.biometrics.BiometricManager#canAuthenticate()](https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.html#canAuthenticate()) method can be used to determine if biometrics can be used.

The method can be used to determine if biometric hardware is present and if the user is enrolled or not.

> 
> Returns BIOMETRIC\_ERROR\_NONE\_ENROLLED if the user does not have any enrolled, or BIOMETRIC\_ERROR\_HW\_UNAVAILABLE if none are currently supported/enabled. Returns BIOMETRIC\_SUCCESS if a biometric can currently be used (enrolled and available).
> 
> 
> 

Hopefully this is added to the `androidx.biometric:biometric` library, so it can be used on all devices.

Until then the solution by @algrid works to determine biometrics enrollment.

And the following can be used to determine, if a fingerprint reader is present.

```
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
            context.packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)

```
There is class method available `FingerprintManagerCompat.from(this).isHardwareDetected` `androidx.core.hardware.fingerprint` package.