BiometricManager
public
class
BiometricManager
extends Object
| java.lang.Object | |
| ↳ | androidx.biometric.BiometricManager |
A class that provides system information related to biometrics (e.g. fingerprint, face, etc.).
On devices running Android 10 (API 29) and above, this will query the framework's version of
BiometricManager. On Android 9.0 (API 28) and prior
versions, 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()
Checks if the user can authenticate with biometrics. |
static
BiometricManager
|
from(Context context)
Creates a |
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 ()
Checks if the user can authenticate with biometrics. This requires at least one biometric sensor to be present, enrolled, and available on the device.
| Returns | |
|---|---|
int |
BIOMETRIC_SUCCESS if the user can authenticate with biometrics. Otherwise,
returns an error code indicating why the user cannot authenticate.
|
from
public static BiometricManager from (Context context)
Creates a BiometricManager instance from the given context.
| Parameters | |
|---|---|
context |
Context |
| Returns | |
|---|---|
BiometricManager |
An instance of BiometricManager.
|