# BiometricPromptData.Builder

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/provider/BiometricPromptData.kt+class:androidx.credentials.provider.BiometricPromptData.Builder) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

*** ** * ** ***


```
public final class BiometricPromptData.Builder
```

<br />

*** ** * ** ***

Builder for constructing an instance of `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData`

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#Builder()()` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` | `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#build()()` Builds the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` instance. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#setAllowedAuthenticators(kotlin.Int)(int allowedAuthenticators)` Specifies the type(s) of authenticators that may be invoked to authenticate the user. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#setCryptoObject(androidx.biometric.BiometricPrompt.CryptoObject)(https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject cryptoObject)` Sets whether this `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` should have a crypto object associated with this authentication. |

## Public constructors

### Builder

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

```
public Builder()
```

## Public methods

### build

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

```
public final @NonNull BiometricPromptData build()
```

Builds the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` instance.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#cryptoObject()` is not null, and the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#allowedAuthenticators()` is not set to `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()` |

### setAllowedAuthenticators

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

```
public final @NonNull BiometricPromptData.Builder setAllowedAuthenticators(int allowedAuthenticators)
```

Specifies the type(s) of authenticators that may be invoked 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()`.

If this method is used and no authenticator of any of the specified types is available at the time an error code will be supplied as part of `https://developer.android.com/reference/android/content/Intent.html` that will be launched by the containing `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry` or `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry`'s corresponding `https://developer.android.com/reference/android/app/PendingIntent.html`.

| Parameters |
|---|---|
| `int allowedAuthenticators` | A bit field representing all valid authenticator types that may be invoked by the Credential Manager selector. |

### setCryptoObject

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

```
public final @NonNull BiometricPromptData.Builder setCryptoObject(BiometricPrompt.CryptoObject cryptoObject)
```

Sets whether this `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` should have a crypto object associated with this authentication. If opting to pass in a value, the `https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData.Builder#allowedAuthenticators()` must be `https://developer.android.com/reference/androidx/biometric/BiometricManager.Authenticators#BIOMETRIC_STRONG()`. The CryptoObject does not presently support presentationSession and operationHandle constructors and intends to support the CryptoObject built from the stable biometric jetpack library described [here](https://developer.android.com/jetpack/androidx/releases/biometric#1.1.0).

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject cryptoObject` | the `https://developer.android.com/reference/androidx/biometric/BiometricPrompt.CryptoObject` to be associated with this biometric authentication flow |