BiometricManager

public class BiometricManager
extends Object

java.lang.Object
   ↳ androidx.biometric.BiometricManager


A class that contains biometric utilities. For authentication, see BiometricPrompt. On devices running Q and above, this will query the framework's version of BiometricManager. On devices P and older, this will query FingerprintManagerCompat.

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()

Determines if biometrics can be used, or equivalently, whether BiometricPrompt can be shown (hardware available, templates enrolled, user-enabled).

static BiometricManager from(Context context)

Inherited methods

Constants

BIOMETRIC_ERROR_HW_UNAVAILABLE

public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE

The hardware is unavailable. Try again later.

Constant Value: 1 (0x00000001)

BIOMETRIC_ERROR_NONE_ENROLLED

public static final int BIOMETRIC_ERROR_NONE_ENROLLED

The user does not have any biometrics enrolled.

Constant Value: 11 (0x0000000b)

BIOMETRIC_ERROR_NO_HARDWARE

public static final int BIOMETRIC_ERROR_NO_HARDWARE

There is no biometric hardware.

Constant Value: 12 (0x0000000c)

BIOMETRIC_SUCCESS

public static final int BIOMETRIC_SUCCESS

No error detected.

Constant Value: 0 (0x00000000)

Public methods

canAuthenticate

public int canAuthenticate ()

Determines if biometrics can be used, or equivalently, whether BiometricPrompt can be shown (hardware available, templates enrolled, user-enabled).

Returns
int BIOMETRIC_SUCCESS if a biometric can currently be used (enrolled and available), BIOMETRIC_ERROR_NONE_ENROLLED if the user does not have any enrolled, or BIOMETRIC_ERROR_NO_HARDWARE if none are currently enabled/supported.

from

public static BiometricManager from (Context context)

Parameters
context Context

Returns
BiometricManager A BiometricManager instance with the provided context.