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

*** ** * ** ***

<br />

```
class CustomCredentialEntry.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry`

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#context()`, `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#type()`, `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#title()`, `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#pendingIntent()`, or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#beginGetCredentialOption()` is null |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#Builder(android.content.Context,kotlin.String,kotlin.CharSequence,android.app.PendingIntent,androidx.credentials.provider.BeginGetCredentialOption)( context: https://developer.android.com/reference/android/content/Context.html, type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, pendingIntent: https://developer.android.com/reference/android/app/PendingIntent.html, beginGetCredentialOption: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption )` constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#build()()` Builds an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry` |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setAutoSelectAllowed(kotlin.Boolean)(autoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether the entry should be auto-selected. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 35) https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setBiometricPromptData(androidx.credentials.provider.BiometricPromptData)(biometricPromptData: https://developer.android.com/reference/kotlin/androidx/credentials/provider/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. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setDefaultIconPreferredAsSingleProvider(kotlin.Boolean)( isDefaultIconPreferredAsSingleProvider: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` When set to true, the UI prefers to render the default credential type icon when you are the single available provider; false by default. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setEntryGroupId(kotlin.CharSequence)(entryGroupId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Sets an ID to uniquely mark this entry for deduplication or for grouping entries during display; if not set, will default to `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#title()`. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setIcon(android.graphics.drawable.Icon)(icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html)` Sets the icon to be show on the UI. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setLastUsedTime(java.time.Instant)(lastUsedTime: https://developer.android.com/reference/java/time/Instant.html?)` Sets the last used time of this account. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setSubtitle(kotlin.CharSequence)(subtitle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Sets a displayName to be shown on the UI with this entry. |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#setTypeDisplayName(kotlin.CharSequence)(typeDisplayName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?)` Sets the display name of this credential type, to be shown on the UI with this entry. |

## Public constructors

### Builder

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

```
Builder(
    context: Context,
    type: String,
    title: CharSequence,
    pendingIntent: PendingIntent,
    beginGetCredentialOption: BeginGetCredentialOption
)
```

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

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the context of the calling app, required to retrieve fallback resources |
| `type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the type string that defines this custom credential |
| `title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | the title shown with this entry on the selector UI |
| `pendingIntent: https://developer.android.com/reference/android/app/PendingIntent.html` | the `https://developer.android.com/reference/android/app/PendingIntent.html` that will get invoked when the user selects this entry, must be created with flag `https://developer.android.com/reference/android/app/PendingIntent.html#FLAG_MUTABLE` to allow the Android system to attach the final request |
| `beginGetCredentialOption: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialOption` | the option from the original `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetCredentialResponse`, for which this credential entry is being added |

## Public functions

### build

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

```
fun build(): CustomCredentialEntry
```

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

### setAutoSelectAllowed

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

```
fun setAutoSelectAllowed(autoSelectAllowed: Boolean): CustomCredentialEntry.Builder
```

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)
fun setBiometricPromptData(biometricPromptData: BiometricPromptData?): CustomCredentialEntry.Builder
```

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.

### setDefaultIconPreferredAsSingleProvider

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

```
fun setDefaultIconPreferredAsSingleProvider(
    isDefaultIconPreferredAsSingleProvider: Boolean
): CustomCredentialEntry.Builder
```

When set to true, the UI prefers to render the default credential type icon when you are the single available provider; false by default.

### setEntryGroupId

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

```
fun setEntryGroupId(entryGroupId: CharSequence): CustomCredentialEntry.Builder
```

Sets an ID to uniquely mark this entry for deduplication or for grouping entries during display; if not set, will default to `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CustomCredentialEntry.Builder#title()`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If the entryGroupId is empty |

### setIcon

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

```
fun setIcon(icon: Icon): CustomCredentialEntry.Builder
```

Sets the icon to be show on the UI. If no icon is set, a default icon representing a custom credential will be set.

### setLastUsedTime

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

```
fun setLastUsedTime(lastUsedTime: Instant?): CustomCredentialEntry.Builder
```

Sets the last used time of this account. This information will be used to sort the entries on the selector.

### setSubtitle

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

```
fun setSubtitle(subtitle: CharSequence?): CustomCredentialEntry.Builder
```

Sets a displayName to be shown on the UI with this entry.

### setTypeDisplayName

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

```
fun setTypeDisplayName(typeDisplayName: CharSequence?): CustomCredentialEntry.Builder
```

Sets the display name of this credential type, to be shown on the UI with this entry.