# BiometricPrompt.PromptInfo.Builder

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

*** ** * ** ***


```
public class BiometricPrompt.PromptInfo.Builder
```

<br />

*** ** * ** ***

A builder used to set individual options for the `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` class.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#build()()` Creates a `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` object with the specified options. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)(int allowedAuthenticators)` Optional: Specifies the type(s) of authenticators that may be invoked by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` to authenticate the user. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setConfirmationRequired(boolean)(boolean confirmationRequired)` Optional: Sets a system hint for whether to require explicit user confirmation after a passive biometric (e.g. iris or face) has been recognized but before `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(androidx.biometric.BiometricPrompt.AuthenticationResult)` is called. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/PromptContentView view)` Optional: Sets application customized content view that will be shown on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html description)` Optional: Sets a description that will be shown on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `[setDeviceCredentialAllowed](https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean))(boolean deviceCredentialAllowed)` **This method is deprecated.** Use `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)` instead. <br /> |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoBitmap(android.graphics.Bitmap)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Bitmap.html logoBitmap)` Optional: Sets the bitmap drawable of the logo that will be shown on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoDescription(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html logoDescription)` Optional: Sets logo description text that will be shown on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoRes(int)(@https://developer.android.com/reference/androidx/annotation/DrawableRes int logoRes)` Optional: Sets the drawable resource of the logo that will be shown on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setNegativeButtonText(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html negativeButtonText)` Required: Sets the text for the negative button on the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setSubtitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html subtitle)` Optional: Sets the subtitle for the prompt. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setTitle(java.lang.CharSequence)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html title)` Required: Sets the title for the prompt. |

## Public constructors

### Builder

Added in 1.0.0

```
public Builder()
```

## Public methods

### build

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

```
public @NonNull BiometricPrompt.PromptInfo build()
```

Creates a `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` object with the specified options.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` | The `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo` object. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If any required option is not set, or if any illegal combination of options is present. |

### setAllowedAuthenticators

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setAllowedAuthenticators(int allowedAuthenticators)
```

Optional: Specifies the type(s) of authenticators that may be invoked by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt` to authenticate the user. Available authenticator types are defined in `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators` and can be combined via bitwise OR. Defaults to:

- `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` for non-crypto authentication, or
- `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` for crypto-based authentication.

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. Setting an unsupported value on an affected Android version will result in an error when calling `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#build()`.

This method should be preferred over `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean)` and overrides the latter if both are used. Using this method to enable device credential authentication (with `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#DEVICE_CREDENTIAL()`) will replace the negative button on the prompt, making it an error to also call `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setNegativeButtonText(java.lang.CharSequence)`.

If this method is used and no authenticator of any of the specified types is available at the time `authenticate()` is called, `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,java.lang.CharSequence)` will be invoked with an appropriate error code.

| Parameters |
|---|---|
| `int allowedAuthenticators` | A bit field representing all valid authenticator types that may be invoked by the prompt. 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/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setConfirmationRequired

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setConfirmationRequired(boolean confirmationRequired)
```

Optional: Sets a system hint for whether to require explicit user confirmation after a passive biometric (e.g. iris or face) has been recognized but before `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(androidx.biometric.BiometricPrompt.AuthenticationResult)` is called. Defaults to `true`.

Disabling this option is generally only appropriate for frequent, low-value transactions, such as re-authenticating for a previously authorized application.

Also note that, as it is merely a hint, this option may be ignored by the system. For example, the system may choose to instead always require confirmation if the user has disabled passive authentication for their device in Settings. Additionally, this option will be ignored on devices running OS versions prior to Android 10 (API 29).

| Parameters |
|---|---|
| `boolean confirmationRequired` | Whether this option should be enabled. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setContentView

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setContentView(@NonNull PromptContentView view)
```

Optional: Sets application customized content view that will be shown on the prompt.

Note that from API 35, the description set by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)` will be overridden by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)`. The view provided to `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)` will be used if both methods are called.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/PromptContentView view` | The customized view information. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setDescription

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setDescription(@Nullable CharSequence description)
```

Optional: Sets a description that will be shown on the prompt.

Note that from API 35, the description set by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)` will be overridden by `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)`. The view provided to `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)` will be used if both methods are called.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html description` | The description to display. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setDeviceCredentialAllowed

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 @NonNull BiometricPrompt.PromptInfo.Builder [setDeviceCredentialAllowed](https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean))(boolean deviceCredentialAllowed)
```

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

Optional: Sets whether the user should be given the option to authenticate with their device PIN, pattern, or password instead of a biometric. Defaults to `false`.

Note that this option is incompatible with `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setNegativeButtonText(java.lang.CharSequence)` and must NOT be enabled if the latter is set.

Before enabling this option, developers should check whether the device is secure by calling `https://developer.android.com/reference/android/app/KeyguardManager.html#isDeviceSecure()`. If the device is not secure, authentication will fail with `https://developer.android.com/reference/androidx/biometric/BiometricConstants#ERROR_NO_DEVICE_CREDENTIAL()`.

On versions prior to Android 10 (API 29), calls to `https://developer.android.com/reference/androidx/biometric/BiometricPrompt#cancelAuthentication()` will not work as expected after the user has chosen to authenticate with their device credential. This is because the library internally launches a separate activity (by calling `https://developer.android.com/reference/android/app/KeyguardManager.html#createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence)`) that does not have a public API for cancellation.

| Parameters |
|---|---|
| `boolean deviceCredentialAllowed` | Whether this option should be enabled. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setLogoBitmap

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

```
@RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED")
public @NonNull BiometricPrompt.PromptInfo.Builder setLogoBitmap(@NonNull Bitmap logoBitmap)
```

Optional: Sets the bitmap drawable of the logo that will be shown on the prompt.

Note that using this method is not recommended in most scenarios because the calling application's icon will be used by default. Setting the logo is intended for large bundled applications that perform a wide range of functions and need to show distinct icons for each function.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Bitmap.html logoBitmap` | A bitmap drawable of the logo that will be shown on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setLogoDescription

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

```
@RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED")
public @NonNull BiometricPrompt.PromptInfo.Builder setLogoDescription(@NonNull String logoDescription)
```

Optional: Sets logo description text that will be shown on the prompt.

Note that using this method is not recommended in most scenarios because the calling application's name will be used by default. Setting the logo description is intended for large bundled applications that perform a wide range of functions and need to show distinct description for each function.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html logoDescription` | The logo description text that will be shown on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If logo description is null or exceeds certain character limit. |

### setLogoRes

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

```
@RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED")
public @NonNull BiometricPrompt.PromptInfo.Builder setLogoRes(@DrawableRes int logoRes)
```

Optional: Sets the drawable resource of the logo that will be shown on the prompt.

Note that using this method is not recommended in most scenarios because the calling application's icon will be used by default. Setting the logo is intended for large bundled applications that perform a wide range of functions and need to show distinct icons for each function.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int logoRes` | A drawable resource of the logo that will be shown on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setNegativeButtonText

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setNegativeButtonText(@NonNull CharSequence negativeButtonText)
```

Required: Sets the text for the negative button on the prompt.

Note that this option is incompatible with device credential authentication and must NOT be set if the latter is enabled via `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)` or `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html negativeButtonText` | The label to be used for the negative button on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setSubtitle

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setSubtitle(@Nullable CharSequence subtitle)
```

Optional: Sets the subtitle for the prompt.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/CharSequence.html subtitle` | The subtitle to be displayed on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setTitle

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

```
public @NonNull BiometricPrompt.PromptInfo.Builder setTitle(@NonNull CharSequence title)
```

Required: Sets the title for the prompt.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html title` | The title to be displayed on the prompt. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |