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

*** ** * ** ***


```
public final class PublicKeyCredentialEntry.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#Builder(android.content.Context,kotlin.CharSequence,android.app.PendingIntent,androidx.credentials.provider.BeginGetPublicKeyCredentialOption)( @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/CharSequence.html username, @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/BeginGetPublicKeyCredentialOption beginGetPublicKeyCredentialOption )` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#build()()` Builds an instance of `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.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/PublicKeyCredentialEntry.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 35) https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.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/PublicKeyCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.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/PublicKeyCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setDisplayName(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html displayName)` 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/PublicKeyCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.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 shown on the UI with this entry |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder` | `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setLastUsedTime(java.time.Instant)(https://developer.android.com/reference/java/time/Instant.html lastUsedTime)` Sets the last used time of this account |

## 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 CharSequence username,
    @NonNull PendingIntent pendingIntent,
    @NonNull BeginGetPublicKeyCredentialOption beginGetPublicKeyCredentialOption
)
```

## Public methods

### build

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

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

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

### setAutoSelectAllowed

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

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

### setDisplayName

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

```
public final @NonNull PublicKeyCredentialEntry.Builder setDisplayName(CharSequence displayName)
```

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

### setIcon

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

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

Sets the icon to be shown on the UI with this entry

### setLastUsedTime

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

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

Sets the last used time of this account

This information will be used to sort the entries on the selector.