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

*** ** * ** ***


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

<br />

*** ** * ** ***

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

## Summary

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

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#build()()` Creates a `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo` object with the specified options. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)(allowedAuthenticators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Optional: Specifies the type(s) of authenticators that may be invoked by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt` to authenticate the user. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setConfirmationRequired(boolean)(confirmationRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` 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/kotlin/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationSucceeded(androidx.biometric.BiometricPrompt.AuthenticationResult)` is called. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)(view: https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentView)` Optional: Sets application customized content view that will be shown on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)(description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Optional: Sets a description that will be shown on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `[setDeviceCredentialAllowed](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean))(deviceCredentialAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoBitmap(android.graphics.Bitmap)(logoBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html)` Optional: Sets the bitmap drawable of the logo that will be shown on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoDescription(java.lang.String)(logoDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Optional: Sets logo description text that will be shown on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission(value = "android.permission.SET_BIOMETRIC_DIALOG_ADVANCED") https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setLogoRes(int)(logoRes: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Optional: Sets the drawable resource of the logo that will be shown on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setNegativeButtonText(java.lang.CharSequence)(negativeButtonText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Required: Sets the text for the negative button on the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setSubtitle(java.lang.CharSequence)(subtitle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Optional: Sets the subtitle for the prompt. |
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setTitle(java.lang.CharSequence)(title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Required: Sets the title for the prompt. |

## Public constructors

### Builder

Added in 1.0.0

```
Builder()
```

## Public functions

### build

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

```
fun build(): BiometricPrompt.PromptInfo
```

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

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo` | The `https://developer.android.com/reference/kotlin/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)

```
fun setAllowedAuthenticators(allowedAuthenticators: Int): BiometricPrompt.PromptInfo.Builder
```

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

- `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_WEAK()` for non-crypto authentication, or
- `https://developer.android.com/reference/kotlin/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/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#build()`.

This method should be preferred over `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/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/kotlin/androidx/biometric/BiometricPrompt.AuthenticationCallback#onAuthenticationError(int,java.lang.CharSequence)` will be invoked with an appropriate error code.

| Parameters |
|---|---|
| `allowedAuthenticators: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | 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://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setConfirmationRequired

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

```
fun setConfirmationRequired(confirmationRequired: Boolean): BiometricPrompt.PromptInfo.Builder
```

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/kotlin/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 |
|---|---|
| `confirmationRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this option should be enabled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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)

```
fun setContentView(view: PromptContentView): BiometricPrompt.PromptInfo.Builder
```

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/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)` will be overridden by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)`. The view provided to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)` will be used if both methods are called.

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/kotlin/androidx/biometric/PromptContentView` | The customized view information. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setDescription

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

```
fun setDescription(description: CharSequence?): BiometricPrompt.PromptInfo.Builder
```

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/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDescription(java.lang.CharSequence)` will be overridden by `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)`. The view provided to `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setContentView(androidx.biometric.PromptContentView)` will be used if both methods are called.

| Parameters |
|---|---|
| `description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | The description to display. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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)

```
fun [setDeviceCredentialAllowed](https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean))(deviceCredentialAllowed: Boolean): BiometricPrompt.PromptInfo.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/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/kotlin/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/kotlin/androidx/biometric/BiometricConstants#ERROR_NO_DEVICE_CREDENTIAL()`.

On versions prior to Android 10 (API 29), calls to `https://developer.android.com/reference/kotlin/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 |
|---|---|
| `deviceCredentialAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this option should be enabled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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")
fun setLogoBitmap(logoBitmap: Bitmap): BiometricPrompt.PromptInfo.Builder
```

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 |
|---|---|
| `logoBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html` | A bitmap drawable of the logo that will be shown on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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")
fun setLogoDescription(logoDescription: String): BiometricPrompt.PromptInfo.Builder
```

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 |
|---|---|
| `logoDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The logo description text that will be shown on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/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")
fun setLogoRes(logoRes: @DrawableRes Int): BiometricPrompt.PromptInfo.Builder
```

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 |
|---|---|
| `logoRes: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A drawable resource of the logo that will be shown on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setNegativeButtonText

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

```
fun setNegativeButtonText(negativeButtonText: CharSequence): BiometricPrompt.PromptInfo.Builder
```

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/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)` or `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setDeviceCredentialAllowed(boolean)`.

| Parameters |
|---|---|
| `negativeButtonText: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | The label to be used for the negative button on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setSubtitle

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

```
fun setSubtitle(subtitle: CharSequence?): BiometricPrompt.PromptInfo.Builder
```

Optional: Sets the subtitle for the prompt.

| Parameters |
|---|---|
| `subtitle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | The subtitle to be displayed on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |

### setTitle

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

```
fun setTitle(title: CharSequence): BiometricPrompt.PromptInfo.Builder
```

Required: Sets the title for the prompt.

| Parameters |
|---|---|
| `title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | The title to be displayed on the prompt. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/biometric/BiometricPrompt.PromptInfo.Builder` | This builder. |