BiometricManager

public class BiometricManager
extends Object

java.lang.Object
   ↳ android.hardware.biometrics.BiometricManager


A class that contains biometric utilities. For authentication, see BiometricPrompt.

Summary

Constants

int BIOMETRIC_ERROR_HW_UNAVAILABLE

The hardware is unavailable.

int BIOMETRIC_ERROR_NONE_ENROLLED

The user does not have any biometrics enrolled.

int BIOMETRIC_ERROR_NO_HARDWARE

There is no biometric hardware.

int BIOMETRIC_SUCCESS

No error detected.

Public methods

int canAuthenticate()

Determine if biometrics can be used.

Inherited methods

Constants

BIOMETRIC_ERROR_HW_UNAVAILABLE

Added in API level 29
public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE

The hardware is unavailable. Try again later.

Constant Value: 1 (0x00000001)

BIOMETRIC_ERROR_NONE_ENROLLED

Added in API level 29
public static final int BIOMETRIC_ERROR_NONE_ENROLLED

The user does not have any biometrics enrolled.

Constant Value: 11 (0x0000000b)

BIOMETRIC_ERROR_NO_HARDWARE

Added in API level 29
public static final int BIOMETRIC_ERROR_NO_HARDWARE

There is no biometric hardware.

Constant Value: 12 (0x0000000c)

BIOMETRIC_SUCCESS

Added in API level 29
public static final int BIOMETRIC_SUCCESS

No error detected.

Constant Value: 0 (0x00000000)

Public methods

canAuthenticate

Added in API level 29
public int canAuthenticate ()

Determine if biometrics can be used. In other words, determine if BiometricPrompt can be expected to be shown (hardware available, templates enrolled, user-enabled).
Requires Manifest.permission.USE_BIOMETRIC

Returns
int 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). Value is BIOMETRIC_SUCCESS, BIOMETRIC_ERROR_HW_UNAVAILABLE, BIOMETRIC_ERROR_NONE_ENROLLED, or BIOMETRIC_ERROR_NO_HARDWARE