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

```
public final class CustomCredentialEntry.Builder
```

<br />

*** ** * ** ***

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

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#Builder(android.content.Context,kotlin.String,kotlin.CharSequence,android.app.PendingIntent,androidx.credentials.provider.BeginGetCredentialOption)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html title, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/PendingIntent.html pendingIntent, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption beginGetCredentialOption )` constructs an instance of `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#build()()` Builds an instance of `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.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/CustomCredentialEntry.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 35) https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.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/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setDefaultIconPreferredAsSingleProvider(kotlin.Boolean)( boolean isDefaultIconPreferredAsSingleProvider )` When set to true, the UI prefers to render the default credential type icon when you are the single available provider; false by default. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setEntryGroupId(kotlin.CharSequence)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html entryGroupId)` 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/androidx/credentials/provider/CustomCredentialEntry.Builder#title()`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setIcon(android.graphics.drawable.Icon)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/drawable/Icon.html icon)` Sets the icon to be show on the UI. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setLastUsedTime(java.time.Instant)(https://developer.android.com/reference/java/time/Instant.html lastUsedTime)` Sets the last used time of this account. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setSubtitle(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html subtitle)` Sets a displayName to be shown on the UI with this entry. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry.Builder#setTypeDisplayName(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html typeDisplayName)` 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)

```
public Builder(
    @NonNull Context context,
    @NonNull String type,
    @NonNull CharSequence title,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetCredentialOption beginGetCredentialOption
)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | the context of the calling app, required to retrieve fallback resources |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html type` | the type string that defines this custom credential |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html title` | the title shown with this entry on the selector UI |
| `@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 flag `https://developer.android.com/reference/android/app/PendingIntent.html#FLAG_MUTABLE` to allow the Android system to attach the final request |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption beginGetCredentialOption` | the option from the original `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialResponse`, for which this credential entry is being added |

## Public methods

### build

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

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

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

### setAutoSelectAllowed

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

```
public final @NonNull CustomCredentialEntry.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 CustomCredentialEntry.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.

### setDefaultIconPreferredAsSingleProvider

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

```
public final @NonNull CustomCredentialEntry.Builder setDefaultIconPreferredAsSingleProvider(
    boolean isDefaultIconPreferredAsSingleProvider
)
```

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)

```
public final @NonNull CustomCredentialEntry.Builder setEntryGroupId(@NonNull CharSequence entryGroupId)
```

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

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

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)

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

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)

```
public final @NonNull CustomCredentialEntry.Builder setSubtitle(CharSequence subtitle)
```

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)

```
public final @NonNull CustomCredentialEntry.Builder setTypeDisplayName(CharSequence typeDisplayName)
```

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