# CreateEntry

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

*** ** * ** ***

<br />

```
@RequiresApi(value = 23)
class CreateEntry
```

<br />

*** ** * ** ***

An entry to be shown on the selector during a create flow initiated when an app calls `https://developer.android.com/reference/kotlin/androidx/credentials/CredentialManager#createCredential(android.content.Context,androidx.credentials.CreateCredentialRequest)`

A `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` points to a location such as an account, or a group where the credential can be registered. When user selects this entry, the corresponding `https://developer.android.com/reference/android/app/PendingIntent.html` is fired, and the credential creation can be completed.

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

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry.Builder` A builder for `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` |

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#fromCreateEntry(android.service.credentials.CreateEntry)(createEntry: https://developer.android.com/reference/android/service/credentials/CreateEntry.html)` Converts a framework `https://developer.android.com/reference/android/service/credentials/CreateEntry.html` class to a Jetpack `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` class |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#CreateEntry(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean)( accountName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, pendingIntent: https://developer.android.com/reference/android/app/PendingIntent.html, description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, lastUsedTime: https://developer.android.com/reference/java/time/Instant.html?, icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html?, passwordCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, publicKeyCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, totalCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 35) https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#CreateEntry(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.credentials.provider.BiometricPromptData)( accountName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, pendingIntent: https://developer.android.com/reference/android/app/PendingIntent.html, description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?, lastUsedTime: https://developer.android.com/reference/java/time/Instant.html?, icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html?, passwordCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, publicKeyCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, totalCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?, isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, biometricPromptData: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData? )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#getPasswordCredentialCount()()` Returns the no. of password type credentials that the provider with this entry has. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#getPublicKeyCredentialCount()()` Returns the no. of public key type credentials that the provider with this entry has. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#getTotalCredentialCount()()` Returns the no. of total credentials that the provider with this entry has. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#accountName()` the name of the account where the credential will be saved |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#biometricPromptData()` the data that is set optionally to utilize a credential manager flow that directly handles the biometric verification and presents back the response; set to null by default, so if not opted in, the embedded biometric prompt flow will not show |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#description()` the localized description shown on UI about where the credential is stored |
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#icon()` the icon to be displayed with this entry on the UI, must be created using `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithResource(android.content.Context, int)` when possible, and especially not with `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)` as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#isAutoSelectAllowed()` whether this entry should be auto selected if it is the only entry on the selector |
| `https://developer.android.com/reference/java/time/Instant.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#lastUsedTime()` the last time the account underlying this entry was used by the user, distinguishable up to the milli second mark only such that if two entries have the same millisecond precision, they will be considered to have been used at the same time |
| `https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#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 companion functions

### fromCreateEntry

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

```
fun fromCreateEntry(createEntry: CreateEntry): CreateEntry?
```

Converts a framework `https://developer.android.com/reference/android/service/credentials/CreateEntry.html` class to a Jetpack `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` class

Note that this API is not needed in a general credential creation flow that is implemented using this jetpack library, where you are only required to construct an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry` to populate the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/BeginCreateCredentialResponse`.

| Parameters |
|---|---|
| `createEntry: https://developer.android.com/reference/android/service/credentials/CreateEntry.html` | the instance of framework class to be converted |

## Public constructors

### CreateEntry

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

```
CreateEntry(
    accountName: CharSequence,
    pendingIntent: PendingIntent,
    description: CharSequence? = null,
    lastUsedTime: Instant? = null,
    icon: Icon? = null,
    passwordCredentialCount: Int? = null,
    publicKeyCredentialCount: Int? = null,
    totalCredentialCount: Int? = null,
    isAutoSelectAllowed: Boolean = false
)
```

| Parameters |
|---|---|
| `accountName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | the name of the account where the credential will be saved |
| `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 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 |
| `description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html? = null` | the localized description shown on UI about where the credential is stored |
| `lastUsedTime: https://developer.android.com/reference/java/time/Instant.html? = null` | the last time the account underlying this entry was used by the user, distinguishable up to the milli second mark only such that if two entries have the same millisecond precision, they will be considered to have been used at the same time |
| `icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html? = null` | the icon to be displayed with this entry on the UI, must be created using `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithResource(android.content.Context, int)` when possible, and especially not with `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)` as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions |
| `passwordCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the no. of password credentials contained by the provider |
| `publicKeyCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the no. of public key credentials contained by the provider |
| `totalCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the total no. of credentials contained by the provider |
| `isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | whether this entry should be auto selected if it is the only entry on the selector |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean)` is empty, or if `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean)` is longer than 300 characters (important: make sure your descriptions across all locales are within this limit) |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean)` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean)` is null |

### CreateEntry

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

```
@RequiresApi(value = 35)
CreateEntry(
    accountName: CharSequence,
    pendingIntent: PendingIntent,
    description: CharSequence? = null,
    lastUsedTime: Instant? = null,
    icon: Icon? = null,
    passwordCredentialCount: Int? = null,
    publicKeyCredentialCount: Int? = null,
    totalCredentialCount: Int? = null,
    isAutoSelectAllowed: Boolean = false,
    biometricPromptData: BiometricPromptData? = null
)
```

| Parameters |
|---|---|
| `accountName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | the name of the account where the credential will be saved |
| `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 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 |
| `description: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html? = null` | the localized description shown on UI about where the credential is stored |
| `lastUsedTime: https://developer.android.com/reference/java/time/Instant.html? = null` | the last time the account underlying this entry was used by the user, distinguishable up to the milli second mark only such that if two entries have the same millisecond precision, they will be considered to have been used at the same time |
| `icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html? = null` | the icon to be displayed with this entry on the UI, must be created using `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithResource(android.content.Context, int)` when possible, and especially not with `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)` as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions |
| `passwordCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the no. of password credentials contained by the provider |
| `publicKeyCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the no. of public key credentials contained by the provider |
| `totalCredentialCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html? = null` | the total no. of credentials contained by the provider |
| `isAutoSelectAllowed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | whether this entry should be auto selected if it is the only entry on the selector |
| `biometricPromptData: https://developer.android.com/reference/kotlin/androidx/credentials/provider/BiometricPromptData? = null` | the data that is set optionally to utilize a credential manager flow that directly handles the biometric verification and presents back the response; set to null by default, so if not opted in, the embedded biometric prompt flow will not show |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.credentials.provider.BiometricPromptData)` is empty, or if `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.credentials.provider.BiometricPromptData)` is longer than 300 characters (important: make sure your descriptions across all locales are within this limit) |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.credentials.provider.BiometricPromptData)` or `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#(kotlin.CharSequence,android.app.PendingIntent,kotlin.CharSequence,java.time.Instant,android.graphics.drawable.Icon,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Boolean,androidx.credentials.provider.BiometricPromptData)` is null |

## Public functions

### getPasswordCredentialCount

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

```
fun getPasswordCredentialCount(): Int?
```

Returns the no. of password type credentials that the provider with this entry has.

### getPublicKeyCredentialCount

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

```
fun getPublicKeyCredentialCount(): Int?
```

Returns the no. of public key type credentials that the provider with this entry has.

### getTotalCredentialCount

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

```
fun getTotalCredentialCount(): Int?
```

Returns the no. of total credentials that the provider with this entry has.

This total count is not necessarily equal to the sum of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#getPasswordCredentialCount()` and `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CreateEntry#getPublicKeyCredentialCount()`.

## Public properties

### accountName

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

```
val accountName: CharSequence
```

the name of the account where the credential will be saved

### biometricPromptData

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

```
val biometricPromptData: BiometricPromptData?
```

the data that is set optionally to utilize a credential manager flow that directly handles the biometric verification and presents back the response; set to null by default, so if not opted in, the embedded biometric prompt flow will not show

### description

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

```
val description: CharSequence?
```

the localized description shown on UI about where the credential is stored

### icon

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

```
val icon: Icon?
```

the icon to be displayed with this entry on the UI, must be created using `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithResource(android.content.Context, int)` when possible, and especially not with `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)` as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions

### isAutoSelectAllowed

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

```
val isAutoSelectAllowed: Boolean
```

whether this entry should be auto selected if it is the only entry on the selector

### lastUsedTime

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

```
val lastUsedTime: Instant?
```

the last time the account underlying this entry was used by the user, distinguishable up to the milli second mark only such that if two entries have the same millisecond precision, they will be considered to have been used at the same time

### pendingIntent

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

```
val pendingIntent: 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