# BiometricManager

Artifact: [androidx.biometric:biometric](https://developer.android.com/jetpack/androidx/releases/biometric) [View Source](https://cs.android.com/search?q=file:androidx/biometric/BiometricManager.java+class:androidx.biometric.BiometricManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

*** ** * ** ***


```
public class BiometricManager
```

<br />

*** ** * ** ***

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 `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.html`. On Android 9.0 (API 28) and prior versions, this will query .

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` | To prompt the user to authenticate with their biometric. |

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators` Types of authenticators, defined at a level of granularity supported by `https://developer.android.com/reference/androidx/biometric/BiometricManager` and `https://developer.android.com/reference/androidx/biometric/BiometricPrompt`. |
| `public class https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` Provides localized strings for an application that uses `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` to authenticate the user. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_HW_UNAVAILABLE() = 1` The user can't authenticate because the hardware is unavailable. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE() = 20` Identity Check is currently not active. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_NONE_ENROLLED() = 11` The user can't authenticate because no biometric or device credential is enrolled. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_NO_HARDWARE() = 12` The user can't authenticate because there is no suitable hardware (e.g. no biometric sensor or no keyguard). |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED() = 15` The user can't authenticate because a security vulnerability has been discovered with one or more hardware sensors. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_ERROR_UNSUPPORTED() = -2` The user can't authenticate because the specified options are incompatible with the current Android version. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_STATUS_UNKNOWN() = -1` Unable to determine whether the user can authenticate. |
| `static final int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_SUCCESS() = 0` The user can successfully authenticate. |

| ### Public methods |
|---|---|
| `int` | `[canAuthenticate](https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate())()` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate(int)` instead. <br /> |
| `int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate(int)(int authenticators)` Checks if the user can authenticate with an authenticator that meets the given requirements. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricManager` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#from(android.content.Context)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` Creates a `https://developer.android.com/reference/androidx/biometric/BiometricManager` instance from the given context. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = https://developer.android.com/reference/android/Manifest.permission.html#USE_BIOMETRIC) https://developer.android.com/reference/androidx/biometric/BiometricManager#getStrings(int)(int authenticators)` Produces an instance of the `https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` class, which provides localized strings for an application, given a set of allowed authenticator types. |

## Constants

### BIOMETRIC_ERROR_HW_UNAVAILABLE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

```
public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1
```

The user can't authenticate because the hardware is unavailable. Try again later.

### BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE

Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
public static final int BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE = 20
```

Identity Check is currently not active. This device either doesn't have this feature enabled, or it's not considered in a high-risk environment that requires extra security measures for accessing sensitive data.

### BIOMETRIC_ERROR_NONE_ENROLLED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

```
public static final int BIOMETRIC_ERROR_NONE_ENROLLED = 11
```

The user can't authenticate because no biometric or device credential is enrolled.

### BIOMETRIC_ERROR_NO_HARDWARE

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

```
public static final int BIOMETRIC_ERROR_NO_HARDWARE = 12
```

The user can't authenticate because there is no suitable hardware (e.g. no biometric sensor or no keyguard).

### BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)

```
public static final int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15
```

The user can't authenticate because a security vulnerability has been discovered with one or more hardware sensors. The affected sensor(s) are unavailable until a security update has addressed the issue.

### BIOMETRIC_ERROR_UNSUPPORTED

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)

```
public static final int BIOMETRIC_ERROR_UNSUPPORTED = -2
```

The user can't authenticate because the specified options are incompatible with the current Android version.

### BIOMETRIC_STATUS_UNKNOWN

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)

```
public static final int BIOMETRIC_STATUS_UNKNOWN = -1
```

Unable to determine whether the user can authenticate.

This status code may be returned on older Android versions due to partial incompatibility with a newer API. Applications that wish to enable biometric authentication on affected devices may still call `BiometricPrompt#authenticate()` after receiving this status code but should be prepared to handle possible errors.

### BIOMETRIC_SUCCESS

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

```
public static final int BIOMETRIC_SUCCESS = 0
```

The user can successfully authenticate.

## Public methods

### canAuthenticate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)

```
public int [canAuthenticate](https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/biometric/BiometricManager#canAuthenticate(int)` instead.

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` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_SUCCESS()` if the user can authenticate with biometrics. Otherwise, returns an error code indicating why the user can't authenticate, or `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_STATUS_UNKNOWN()` if it is unknown whether the user can authenticate. |

### canAuthenticate

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0)

```
public int canAuthenticate(int authenticators)
```

Checks if the user can authenticate with an authenticator that meets the given requirements. This requires at least one of the specified authenticators to be present, enrolled, and available on the device.

Note that not all combinations of authenticator types are supported prior to Android 11 (API 30). Specifically, `DEVICE_CREDENTIAL` alone is unsupported prior to API 30, and `BIOMETRIC_STRONG | DEVICE_CREDENTIAL` is unsupported on API 28-29. Developers that wish to check for the presence of a PIN, pattern, or password on these versions should instead use `https://developer.android.com/reference/android/app/KeyguardManager.html#isDeviceSecure()`.

| Parameters |
|---|---|
| `int authenticators` | A bit field representing the types of `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators` that may be used for authentication. Value is either `0` or a combination of the following: - `Authenticators.BIOMETRIC_STRONG` - `Authenticators.BIOMETRIC_WEAK` - `Authenticators.DEVICE_CREDENTIAL` - `Authenticators.IDENTITY_CHECK` <br /> |

| Returns |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_SUCCESS()` if the user can authenticate with an allowed authenticator. Otherwise, returns `https://developer.android.com/reference/androidx/biometric/BiometricManager#BIOMETRIC_STATUS_UNKNOWN()` or an error code indicating why the user can't authenticate. |

### from

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/biometric#1.0.0)

```
public static @NonNull BiometricManager from(@NonNull Context context)
```

Creates a `https://developer.android.com/reference/androidx/biometric/BiometricManager` instance from the given context.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The application or activity context. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricManager` | An instance of `https://developer.android.com/reference/androidx/biometric/BiometricManager`. |

### getStrings

Added in [1.4.0-beta01](https://developer.android.com/jetpack/androidx/releases/biometric#1.4.0-beta01)

```
@RequiresPermission(value = Manifest.permission.USE_BIOMETRIC)
public @Nullable BiometricManager.Strings getStrings(int authenticators)
```

Produces an instance of the `https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` class, which provides localized strings for an application, given a set of allowed authenticator types.

| Parameters |
|---|---|
| `int authenticators` | A bit field representing the types of `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators` that may be used for authentication. Value is either `0` or a combination of the following: - `Authenticators.BIOMETRIC_STRONG` - `Authenticators.BIOMETRIC_WEAK` - `Authenticators.DEVICE_CREDENTIAL` - `Authenticators.IDENTITY_CHECK` <br /> |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` | A `https://developer.android.com/reference/androidx/biometric/BiometricManager.Strings` collection for the given allowed authenticator types. |