# CreateEntry.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/CreateEntry.kt+class:androidx.credentials.provider.CreateEntry.Builder) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
public final class CreateEntry.Builder
```

<br />

*** ** * ** ***

A builder for `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry`

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#Builder(kotlin.CharSequence,android.app.PendingIntent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html accountName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent )` constructs an instance of `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#build()()` Builds an instance of `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setAutoSelectAllowed(kotlin.Boolean)(boolean autoSelectAllowed)` Sets whether the entry should be auto-selected. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 35) https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setBiometricPromptData(androidx.credentials.provider.BiometricPromptData)(https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData biometricPromptData)` Sets the biometric prompt data to optionally utilize a credential manager flow that directly handles the biometric verification for you and gives you the response; set to null by default, indicating the default behavior is to not utilize this embedded biometric prompt flow. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setDescription(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html description)` Sets a localized description to be displayed on the UI at the time of credential creation. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setIcon(android.graphics.drawable.Icon)(https://developer.android.com/reference/android/graphics/drawable/Icon.html icon)` Sets an icon to be displayed with the entry on the UI |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setLastUsedTime(java.time.Instant)(https://developer.android.com/reference/java/time/Instant.html lastUsedTime)` Sets the last time this account was used |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setPasswordCredentialCount(kotlin.Int)(int count)` Sets the password credential count, denoting how many credentials of type `https://developer.android.com/reference/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` does the provider have stored. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setPublicKeyCredentialCount(kotlin.Int)(int count)` Sets the password credential count, denoting how many credentials of type `https://developer.android.com/reference/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()` does the provider have stored. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setTotalCredentialCount(kotlin.Int)(int count)` Sets the total credential count, denoting how many credentials in total does the provider have stored. |

## Public constructors

### Builder

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

```
public Builder(
    @NonNull CharSequence accountName,
    @NonNull PendingIntent pendingIntent
)
```

constructs an instance of `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html accountName` | the name of the account where the credential will be registered |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent` | the `https://developer.android.com/reference/android/app/PendingIntent.html` that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag `https://developer.android.com/reference/android/app/PendingIntent.html#FLAG_MUTABLE` to allow the Android system to attach the final request, and NOT with flag `https://developer.android.com/reference/android/app/PendingIntent.html#FLAG_ONE_SHOT` as it can be invoked multiple times |

## Public methods

### build

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

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

Builds an instance of `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry`

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#accountName()` is empty |

### setAutoSelectAllowed

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

```
public final @NonNull CreateEntry.Builder setAutoSelectAllowed(boolean autoSelectAllowed)
```

Sets whether the entry should be auto-selected. The value is false by default.

### setBiometricPromptData

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

```
@RequiresApi(value = 35)
public final @NonNull CreateEntry.Builder setBiometricPromptData(BiometricPromptData biometricPromptData)
```

Sets the biometric prompt data to optionally utilize a credential manager flow that directly handles the biometric verification for you and gives you the response; set to null by default, indicating the default behavior is to not utilize this embedded biometric prompt flow.

### setDescription

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

```
public final @NonNull CreateEntry.Builder setDescription(CharSequence description)
```

Sets a localized description to be displayed on the UI at the time of credential creation.

Typically this description should contain information informing the user of the credential being created, and where it is being stored. Providers are free to phrase this however they see fit.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setDescription(kotlin.CharSequence)` is longer than 300 characters ( important: make sure your descriptions across all locales are within this limit). |

### setIcon

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

```
public final @NonNull CreateEntry.Builder setIcon(Icon icon)
```

Sets an icon to be displayed with the entry on the UI

### setLastUsedTime

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

```
public final @NonNull CreateEntry.Builder setLastUsedTime(Instant lastUsedTime)
```

Sets the last time this account was used

### setPasswordCredentialCount

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

```
public final @NonNull CreateEntry.Builder setPasswordCredentialCount(int count)
```

Sets the password credential count, denoting how many credentials of type `https://developer.android.com/reference/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()` does the provider have stored.

This information will be displayed on the `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` to help the user make a choice.

### setPublicKeyCredentialCount

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

```
public final @NonNull CreateEntry.Builder setPublicKeyCredentialCount(int count)
```

Sets the password credential count, denoting how many credentials of type `https://developer.android.com/reference/androidx/credentials/PublicKeyCredential#TYPE_PUBLIC_KEY_CREDENTIAL()` does the provider have stored.

This information will be displayed on the `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` to help the user make a choice.

### setTotalCredentialCount

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

```
public final @NonNull CreateEntry.Builder setTotalCredentialCount(int count)
```

Sets the total credential count, denoting how many credentials in total does the provider have stored.

This total count no. does not need to be a total of the counts set through `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setPasswordCredentialCount(kotlin.Int)` and `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry.Builder#setPublicKeyCredentialCount(kotlin.Int)`.

This information will be displayed on the `https://developer.android.com/reference/androidx/credentials/provider/CreateEntry` to help the user make a choice.