Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#nestedclasses) \| [Constants](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#constants) \| [Methods](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#inhmethods)

# BiometricPrompt

*** ** * ** ***


`
public


class
BiometricPrompt
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.biometrics.BiometricPrompt |

<br />

*** ** * ** ***

A class that manages a system-provided biometric dialog.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback` Callback structure provided to `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)` or `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.hardware.biometrics.BiometricPrompt.CryptoObject,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)`. |
| ` class` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult` Container for callback data from `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)` and `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.hardware.biometrics.BiometricPrompt.CryptoObject,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)`. |
| ` class` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder` A builder that collects arguments to be shown on the system-provided biometric dialog. |
| ` class` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.CryptoObject` A wrapper class for the cryptographic operations supported by BiometricPrompt. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#AUTHENTICATION_RESULT_TYPE_BIOMETRIC` Authentication type reported by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult` when the user authenticated by presenting some form of biometric (e.g. fingerprint or face). |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL` Authentication type reported by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult` when the user authenticated by entering their device PIN, pattern, or password. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_GOOD` The image acquired was good. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_IMAGER_DIRTY` The biometric image was too noisy due to suspected or detected dirt on the sensor. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_INSUFFICIENT` The biometric image was too noisy to process due to a detected condition or a possibly dirty sensor (See `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_IMAGER_DIRTY`). |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_PARTIAL` Only a partial biometric image was detected. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_TOO_FAST` The biometric image was incomplete due to quick motion. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_TOO_SLOW` The biometric image was unreadable due to lack of motion. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_CANCELED` The operation was canceled because the biometric sensor is unavailable. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_HW_NOT_PRESENT` The device does not have a biometric sensor. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_HW_UNAVAILABLE` The hardware is unavailable. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE` Identity Check is currently not active. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_LOCKOUT` The operation was canceled because the API is locked out due to too many attempts. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_LOCKOUT_PERMANENT` The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS` Biometrics is not allowed to verify the user in apps. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_NO_BIOMETRICS` The user does not have any biometrics enrolled. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL` The device does not have pin, pattern, or password set up. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_NO_SPACE` Error state returned for operations like enrollment; the operation cannot be completed because there's not enough storage remaining to complete the operation. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED` A security vulnerability has been discovered and the sensor is unavailable until a security update has addressed this issue. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_TIMEOUT` Error state returned when the current request has been running too long. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_UNABLE_TO_PROCESS` Error state returned when the sensor was unable to process the current image. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_USER_CANCELED` The user canceled the operation. |
| `int` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ERROR_VENDOR` OEMs should use this constant if there are conditions that do not fit under any of the other publicly defined constants, and must provide appropriate strings for these errors to the `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)` callback. |
| `long` | `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_NO_AUTHENTICATION` Returned from `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#getLastAuthenticationTime(int)` when there has been no successful authentication for the given authenticator since boot. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)(https://developer.android.com/reference/android/os/CancellationSignal cancel, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback callback) ` This call warms up the biometric hardware, displays a system-provided dialog, and starts scanning for a biometric. |
| ` void` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.hardware.biometrics.BiometricPrompt.CryptoObject,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)(https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.CryptoObject crypto, https://developer.android.com/reference/android/os/CancellationSignal cancel, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback callback) ` This call warms up the biometric hardware, displays a system-provided dialog, and starts scanning for a biometric. |
| ` int` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getAllowedAuthenticators()() ` Gets the type(s) of authenticators that may be invoked by the prompt to authenticate the user, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setAllowedAuthenticators(int)`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getAuthenticationPurpose()() ` Gets the authentication purpose for the prompt. |
| ` https://developer.android.com/reference/android/hardware/biometrics/PromptContentView` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getContentView()() ` Gets the content view for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setContentView(android.hardware.biometrics.PromptContentView)`. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getDescription()() ` Gets the description for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setDescription(java.lang.CharSequence)`. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/biometrics/FallbackOption>` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getFallbackOptions()() ` Gets the fallback options for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#addFallbackOption(java.lang.CharSequence,%20int,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`. |
| ` https://developer.android.com/reference/android/graphics/Bitmap` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getLogoBitmap()() ` Gets the logo bitmap for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoBitmap(android.graphics.Bitmap)`. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getLogoDescription()() ` Gets the logo description for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoDescription(java.lang.String)`. |
| ` int` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getLogoRes()() ` Gets the drawable resource of the logo for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoRes(int)`. |
| ` static int` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getMaxFallbackOptions()() ` |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getNegativeButtonText()() ` Gets the negative button text for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setNegativeButton(java.lang.CharSequence,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getSubtitle()() ` Gets the subtitle for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setSubtitle(java.lang.CharSequence)`. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#getTitle()() ` Gets the title for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setTitle(java.lang.CharSequence)`. |
| ` boolean` | ` https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#isConfirmationRequired()() ` Determines if explicit user confirmation is required by the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setConfirmationRequired(boolean)`. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### AUTHENTICATION_RESULT_TYPE_BIOMETRIC

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUTHENTICATION_RESULT_TYPE_BIOMETRIC
```

Authentication type reported by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult` when the user authenticated by
presenting some form of biometric (e.g. fingerprint or face).

<br />

Constant Value:

2
(0x00000002)


### AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL
```

Authentication type reported by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationResult` when the user authenticated by
entering their device PIN, pattern, or password.

<br />

Constant Value:

1
(0x00000001)


### BIOMETRIC_ACQUIRED_GOOD

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_GOOD
```

The image acquired was good.

<br />

Constant Value:

0
(0x00000000)


### BIOMETRIC_ACQUIRED_IMAGER_DIRTY

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_IMAGER_DIRTY
```

The biometric image was too noisy due to suspected or detected dirt on the sensor. For
example, it's reasonable return this after multiple `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_INSUFFICIENT`
or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected
to take action to clean the sensor when this is returned.

<br />

Constant Value:

3
(0x00000003)


### BIOMETRIC_ACQUIRED_INSUFFICIENT

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_INSUFFICIENT
```

The biometric image was too noisy to process due to a detected condition or a possibly dirty
sensor (See `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#BIOMETRIC_ACQUIRED_IMAGER_DIRTY`).

<br />

Constant Value:

2
(0x00000002)


### BIOMETRIC_ACQUIRED_PARTIAL

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_PARTIAL
```

Only a partial biometric image was detected. During enrollment, the user should be informed
on what needs to happen to resolve this problem, e.g. "press firmly on sensor." (for
fingerprint)

<br />

Constant Value:

1
(0x00000001)


### BIOMETRIC_ACQUIRED_TOO_FAST

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_TOO_FAST
```

The biometric image was incomplete due to quick motion. For example, this could also happen
if the user moved during acquisition. The user should be asked to repeat the operation more
slowly.

<br />

Constant Value:

5
(0x00000005)


### BIOMETRIC_ACQUIRED_TOO_SLOW

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ACQUIRED_TOO_SLOW
```

The biometric image was unreadable due to lack of motion.

<br />

Constant Value:

4
(0x00000004)


### BIOMETRIC_ERROR_CANCELED

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_CANCELED
```

The operation was canceled because the biometric sensor is unavailable. For example, this may
happen when the user is switched, the device is locked or another pending operation prevents
or disables it.

<br />

Constant Value:

5
(0x00000005)


### BIOMETRIC_ERROR_HW_NOT_PRESENT

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_HW_NOT_PRESENT
```

The device does not have a biometric sensor.

<br />

Constant Value:

12
(0x0000000c)


### BIOMETRIC_ERROR_HW_UNAVAILABLE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE
```

The hardware is unavailable. Try again later.

<br />

Constant Value:

1
(0x00000001)


### BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_IDENTITY_CHECK_NOT_ACTIVE
```

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.

<br />

Constant Value:

20
(0x00000014)


### BIOMETRIC_ERROR_LOCKOUT

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_LOCKOUT
```

The operation was canceled because the API is locked out due to too many attempts.
This occurs after 5 failed attempts, and lasts for 30 seconds.

<br />

Constant Value:

7
(0x00000007)


### BIOMETRIC_ERROR_LOCKOUT_PERMANENT

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_LOCKOUT_PERMANENT
```

The operation was canceled because BIOMETRIC_ERROR_LOCKOUT occurred too many times.
Biometric authentication is disabled until the user unlocks with strong authentication
(PIN/Pattern/Password)

<br />

Constant Value:

9
(0x00000009)


### BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_NOT_ENABLED_FOR_APPS
```

Biometrics is not allowed to verify the user in apps.

<br />

Constant Value:

21
(0x00000015)


### BIOMETRIC_ERROR_NO_BIOMETRICS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_NO_BIOMETRICS
```

The user does not have any biometrics enrolled.

<br />

Constant Value:

11
(0x0000000b)


### BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL
```

The device does not have pin, pattern, or password set up. See
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setAllowedAuthenticators(int)`,
`https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators#DEVICE_CREDENTIAL`, and `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#canAuthenticate(int)`.

<br />

Constant Value:

14
(0x0000000e)


### BIOMETRIC_ERROR_NO_SPACE

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_NO_SPACE
```

Error state returned for operations like enrollment; the operation cannot be completed
because there's not enough storage remaining to complete the operation.

<br />

Constant Value:

4
(0x00000004)


### BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED
```

A security vulnerability has been discovered and the sensor is unavailable until a
security update has addressed this issue. This error can be received if for example,
authentication was requested with `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators#BIOMETRIC_STRONG`, but the
sensor's strength can currently only meet `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators#BIOMETRIC_WEAK`.

<br />

Constant Value:

15
(0x0000000f)


### BIOMETRIC_ERROR_TIMEOUT

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_TIMEOUT
```

Error state returned when the current request has been running too long. This is intended to
prevent programs from waiting for the biometric sensor indefinitely. The timeout is platform
and sensor-specific, but is generally on the order of 30 seconds.

<br />

Constant Value:

3
(0x00000003)


### BIOMETRIC_ERROR_UNABLE_TO_PROCESS

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_UNABLE_TO_PROCESS
```

Error state returned when the sensor was unable to process the current image.

<br />

Constant Value:

2
(0x00000002)


### BIOMETRIC_ERROR_USER_CANCELED

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_USER_CANCELED
```

The user canceled the operation. Upon receiving this, applications should use alternate
authentication (e.g. a password). The application should also provide the means to return to
biometric authentication, such as a "use " button.

<br />

Constant Value:

10
(0x0000000a)


### BIOMETRIC_ERROR_VENDOR

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BIOMETRIC_ERROR_VENDOR
```

OEMs should use this constant if there are conditions that do not fit under any of the other
publicly defined constants, and must provide appropriate strings for these
errors to the `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)` callback. OEMs should expect that the error message will be shown to users.

<br />

Constant Value:

8
(0x00000008)


### BIOMETRIC_NO_AUTHENTICATION

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long BIOMETRIC_NO_AUTHENTICATION
```

Returned from `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#getLastAuthenticationTime(int)` when there has
been no successful authentication for the given authenticator since boot.

<br />

Constant Value:

-1
(0xffffffffffffffff)


## Public methods

### authenticate

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void authenticate (CancellationSignal cancel, 
                Executor executor, 
                BiometricPrompt.AuthenticationCallback callback)
```

This call warms up the biometric hardware, displays a system-provided dialog, and starts
scanning for a biometric. It terminates when `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)` is called, when `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(android.hardware.biometrics.BiometricPrompt.AuthenticationResult)` is called, or when
the user dismisses the system-provided dialog. This operation can be canceled by using the
provided cancel object. The application will receive authentication errors through `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback`, and button events through the corresponding callback set in `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setNegativeButton(java.lang.CharSequence,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)` or
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#addFallbackOption(java.lang.CharSequence,%20int,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`.
It is safe to reuse the `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt` object, and calling `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)` while
an existing authentication attempt is occurring will stop the previous client and start a
new authentication. The interrupted client will receive a cancelled notification through
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)`.

Note: Applications generally should not cancel and start authentication in quick
succession. For example, to properly handle authentication across configuration changes,
it's recommended to use BiometricPrompt in a fragment with setRetainInstance(true). By doing
so, the application will not need to cancel/restart authentication during the configuration
change.


Requires `https://developer.android.com/reference/android/Manifest.permission#USE_BIOMETRIC`

<br />

| Parameters ||
|---|---|
| `cancel` | `CancellationSignal`: An object that can be used to cancel authentication. This value cannot be `null`. <br /> |
| `executor` | `Executor`: An executor to handle callback events. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `BiometricPrompt.AuthenticationCallback`: An object to receive authentication events. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If any of the arguments are null. |

### authenticate

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void authenticate (BiometricPrompt.CryptoObject crypto, 
                CancellationSignal cancel, 
                Executor executor, 
                BiometricPrompt.AuthenticationCallback callback)
```

This call warms up the biometric hardware, displays a system-provided dialog, and starts
scanning for a biometric. It terminates when `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)` is called, when `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(android.hardware.biometrics.BiometricPrompt.AuthenticationResult)`, or when the user
dismisses the system-provided dialog, at which point the crypto object becomes invalid. This
operation can be canceled by using the provided cancel object. The application will receive
authentication errors through `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback`, and button events through the
corresponding callback set in `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setNegativeButton(java.lang.CharSequence,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)` or
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#addFallbackOption(java.lang.CharSequence,%20int,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`. It is safe to reuse the `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt` object,
and calling `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt#authenticate(android.os.CancellationSignal,%20java.util.concurrent.Executor,%20android.hardware.biometrics.BiometricPrompt.AuthenticationCallback)` while an existing authentication attempt is occurring will stop the
previous client and start a new authentication. The interrupted client will receive a
cancelled notification through `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,%20java.lang.CharSequence)`.

Note: Applications generally should not cancel and start authentication in quick
succession. For example, to properly handle authentication across configuration changes, it's
recommended to use BiometricPrompt in a fragment with setRetainInstance(true). By doing so,
the application will not need to cancel/restart authentication during the configuration
change.

Per the Android CDD, only biometric authenticators that meet or exceed the requirements
for **Strong** are permitted to integrate with Keystore to perform related
cryptographic operations. Therefore, it is an error to call this method after explicitly
calling `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setAllowedAuthenticators(int)` with any biometric strength other than
`https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators#BIOMETRIC_STRONG`.


Requires `https://developer.android.com/reference/android/Manifest.permission#USE_BIOMETRIC`

<br />

| Parameters ||
|---|---|
| `crypto` | `BiometricPrompt.CryptoObject`: A cryptographic operation to be unlocked after successful authentication. This value cannot be `null`. <br /> |
| `cancel` | `CancellationSignal`: An object that can be used to cancel authentication. This value cannot be `null`. <br /> |
| `executor` | `Executor`: An executor to handle callback events. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `BiometricPrompt.AuthenticationCallback`: An object to receive authentication events. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If any argument is null, or if the allowed biometric authenticator strength is explicitly set to `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators#BIOMETRIC_WEAK`. Prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES#R`, this exception is also thrown if `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setDeviceCredentialAllowed(boolean)` was explicitly set to true. |

### getAllowedAuthenticators

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getAllowedAuthenticators ()
```

Gets the type(s) of authenticators that may be invoked by the prompt to authenticate the
user, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setAllowedAuthenticators(int)`.

<br />

| Returns ||
|---|---|
| `int` | A bit field representing the type(s) of authenticators that may be invoked by the prompt (as defined by `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager.Authenticators`), or 0 if this field was not set. This value may be `null`. <br /> |

### getAuthenticationPurpose

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getAuthenticationPurpose ()
```

Gets the authentication purpose for the prompt.

<br />

| Returns ||
|---|---|
| `int` | The authentication purpose. Value is one of the following: - `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#AUTHENTICATION_PURPOSE_UNKNOWN` - `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#AUTHENTICATION_PURPOSE_PAYMENT` - `https://developer.android.com/reference/android/hardware/biometrics/BiometricManager#AUTHENTICATION_PURPOSE_LOGIN` |

### getContentView

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PromptContentView getContentView ()
```

Gets the content view for the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setContentView(android.hardware.biometrics.PromptContentView)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/hardware/biometrics/PromptContentView` | The content view for the prompt, or null if the prompt has no content view. <br /> |

### getDescription

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getDescription ()
```

Gets the description for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setDescription(java.lang.CharSequence)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The description for the prompt, or null if the prompt has no description. <br /> |

### getFallbackOptions

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public List<FallbackOption> getFallbackOptions ()
```

Gets the fallback options for the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#addFallbackOption(java.lang.CharSequence,%20int,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/hardware/biometrics/FallbackOption>` | The fallback options for the prompt. This value cannot be `null`. <br /> |

### getLogoBitmap

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bitmap getLogoBitmap ()
```

Gets the logo bitmap for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoBitmap(android.graphics.Bitmap)`.
Currently for system applications use only.


Requires `https://developer.android.com/reference/android/Manifest.permission#SET_BIOMETRIC_DIALOG_ADVANCED`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Bitmap` | The logo bitmap of the prompt, or null if the prompt has no logo bitmap set. <br /> |

### getLogoDescription

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getLogoDescription ()
```

Gets the logo description for the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoDescription(java.lang.String)`.
Currently for system applications use only.


Requires `https://developer.android.com/reference/android/Manifest.permission#SET_BIOMETRIC_DIALOG_ADVANCED`

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | The logo description of the prompt, or null if the prompt has no logo description set. <br /> |

### getLogoRes

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getLogoRes ()
```

Gets the drawable resource of the logo for the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setLogoRes(int)`. Currently for system applications use only.


Requires `https://developer.android.com/reference/android/Manifest.permission#SET_BIOMETRIC_DIALOG_ADVANCED`

<br />

| Returns ||
|---|---|
| `int` | The drawable resource of the logo, or 0 if the prompt has no logo resource set. <br /> |

### getMaxFallbackOptions

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static int getMaxFallbackOptions ()
```

<br />

<br />

| Returns ||
|---|---|
| `int` | the maximum amount of fallback options that can be added to the prompt <br /> |

### getNegativeButtonText

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getNegativeButtonText ()
```

Gets the negative button text for the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setNegativeButton(java.lang.CharSequence,%20java.util.concurrent.Executor,%20android.content.DialogInterface.OnClickListener)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The negative button text for the prompt, or null if no negative button text was set. <br /> |

### getSubtitle

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getSubtitle ()
```

Gets the subtitle for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setSubtitle(java.lang.CharSequence)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The subtitle for the prompt, or null if the prompt has no subtitle. <br /> |

### getTitle

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getTitle ()
```

Gets the title for the prompt, as set by `https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setTitle(java.lang.CharSequence)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | The title of the prompt, which is guaranteed to be non-null. <br /> |

### isConfirmationRequired

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isConfirmationRequired ()
```

Determines if explicit user confirmation is required by the prompt, as set by
`https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt.Builder#setConfirmationRequired(boolean)`.

<br />

| Returns ||
|---|---|
| `boolean` | true if explicit user confirmation is required, or false otherwise. <br /> |