# PublicKeyCredentialEntry.Builder

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry.Builder "View this page in Java")

<br />

```
class PublicKeyCredentialEntry.Builder
```

<br />

*** ** * ** ***

Builder for[PublicKeyCredentialEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry)

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                       ### Public constructors                                                                                                                                                                                                                                                                                                                                                                                       |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#Builder(android.content.Context,kotlin.CharSequence,android.app.PendingIntent,androidx.credentials.provider.BeginGetPublicKeyCredentialOption))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`,` ` username: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`,` ` pendingIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`,` ` beginGetPublicKeyCredentialOption: `[BeginGetPublicKeyCredentialOption](https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginGetPublicKeyCredentialOption) `)` |

|                                                               ### Public functions                                                                |
|---------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PublicKeyCredentialEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry)                 | [build](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#build())`()` Builds an instance of[PublicKeyCredentialEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry)                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | [setAutoSelectAllowed](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setAutoSelectAllowed(kotlin.Boolean))`(autoSelectAllowed: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Sets whether the entry should be auto-selected.                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = 35)` [setBiometricPromptData](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setBiometricPromptData(androidx.credentials.provider.BiometricPromptData))`(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. |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | [setDefaultIconPreferredAsSingleProvider](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setDefaultIconPreferredAsSingleProvider(kotlin.Boolean))`(` ` isDefaultIconPreferredAsSingleProvider: `[Boolean](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.                                                                                                                                                                                                                                                                       |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | [setDisplayName](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setDisplayName(kotlin.CharSequence))`(displayName: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?)` Sets a displayName to be shown on the UI with this entry                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | [setIcon](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setIcon(android.graphics.drawable.Icon))`(icon: `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon.html)`)` Sets the icon to be shown on the UI with this entry                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [PublicKeyCredentialEntry.Builder](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder) | [setLastUsedTime](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry.Builder#setLastUsedTime(java.time.Instant))`(lastUsedTime: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`?)` 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)  

```
Builder(
    context: Context,
    username: CharSequence,
    pendingIntent: PendingIntent,
    beginGetPublicKeyCredentialOption: BeginGetPublicKeyCredentialOption
)
```  

## Public functions

### build

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

```
fun build(): PublicKeyCredentialEntry
```

Builds an instance of[PublicKeyCredentialEntry](https://developer.android.com/reference/kotlin/androidx/credentials/provider/PublicKeyCredentialEntry)  

### setAutoSelectAllowed

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

```
fun setAutoSelectAllowed(autoSelectAllowed: Boolean): PublicKeyCredentialEntry.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?): PublicKeyCredentialEntry.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
): PublicKeyCredentialEntry.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.  

### setDisplayName

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

```
fun setDisplayName(displayName: CharSequence?): PublicKeyCredentialEntry.Builder
```

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)  

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

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)  

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

Sets the last used time of this account

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