# CredentialEntry

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/provider/CredentialEntry.kt+class:androidx.credentials.provider.CredentialEntry) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
public abstract class CredentialEntry
```

<br />

Known direct subclasses [CustomCredentialEntry](https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry), [PasswordCredentialEntry](https://developer.android.com/reference/androidx/credentials/provider/PasswordCredentialEntry), [PublicKeyCredentialEntry](https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry)

|---|---|
| `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry` | Custom credential entry for a custom credential type that is displayed on the account selector UI. |
| `https://developer.android.com/reference/androidx/credentials/provider/PasswordCredentialEntry` | A password credential entry that is displayed on the account selector UI. |
| `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry` | A public key credential entry that is displayed on the account selector UI. |

*** ** * ** ***

Base class for a credential entry to be displayed on the selector.

The `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#entryGroupId()` allows the credential selector display to, in the case of multiple entries across providers that have the same `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#entryGroupId()` value, trim down to a single, most recently used provider on the primary card, meant for quick authentication. This will also be used for entry grouping display logic. However, if the user desires, it is possible to expand back the entries and select the provider of their choice. This should be something directly linked to the credential (e.g. `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry` and `https://developer.android.com/reference/androidx/credentials/provider/PasswordCredentialEntry` utilize 'username'), and should allow variance only as far as the case of letters (i.e. Foo@gmail.com and foo@gmail.com). These guidelines should be followed in cases where `https://developer.android.com/reference/androidx/credentials/provider/CustomCredentialEntry` are created.

(RestrictTo property) type the type of the credential associated with this entry, e.g. a `https://developer.android.com/reference/androidx/credentials/provider/BeginGetPasswordOption` will have type `https://developer.android.com/reference/androidx/credentials/PasswordCredential#TYPE_PASSWORD_CREDENTIAL()`

## Summary

| ### Public methods |
|---|---|
| `static final https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#fromCredentialEntry(android.service.credentials.CredentialEntry)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/service/credentials/CredentialEntry.html credentialEntry)` Converts a framework `https://developer.android.com/reference/android/service/credentials/CredentialEntry.html` class to a Jetpack `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry` class |
| `final https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#getAffiliatedDomain()()` the user visible affiliated domain, a CharSequence representation of a web domain or an app package name that the given credential in this entry is associated with when it is different from the requesting entity, default null |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialOption` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#getBeginGetCredentialOption()()` the option from the original `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialRequest`, for which this credential entry is being added |
| `final https://developer.android.com/reference/androidx/credentials/provider/BiometricPromptData` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#getBiometricPromptData()()` 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 |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#getEntryGroupId()()` an ID used for deduplication or to group entries during display |
| `final boolean` | `https://developer.android.com/reference/androidx/credentials/provider/CredentialEntry#isDefaultIconPreferredAsSingleProvider()()` when set to true, the UI prefers to render the default credential type icon when you are the only available provider; see individual subclasses for these default icons (e.g. for `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry`, it is based on `R.drawable.adx_ic_password`) |

## Public methods

### fromCredentialEntry

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

```
public static final CredentialEntry fromCredentialEntry(@NonNull CredentialEntry credentialEntry)
```

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

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/service/credentials/CredentialEntry.html credentialEntry` | the instance of framework class to be converted |

### getAffiliatedDomain

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

```
public final CharSequence getAffiliatedDomain()
```

the user visible affiliated domain, a CharSequence representation of a web domain or an app package name that the given credential in this entry is associated with when it is different from the requesting entity, default null

### getBeginGetCredentialOption

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

```
public final @NonNull BeginGetCredentialOption getBeginGetCredentialOption()
```

the option from the original `https://developer.android.com/reference/androidx/credentials/provider/BeginGetCredentialRequest`, for which this credential entry is being added

### getBiometricPromptData

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

```
public final BiometricPromptData getBiometricPromptData()
```

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

### getEntryGroupId

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

```
public final @NonNull CharSequence getEntryGroupId()
```

an ID used for deduplication or to group entries during display

### isDefaultIconPreferredAsSingleProvider

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

```
public final boolean isDefaultIconPreferredAsSingleProvider()
```

when set to true, the UI prefers to render the default credential type icon when you are the only available provider; see individual subclasses for these default icons (e.g. for `https://developer.android.com/reference/androidx/credentials/provider/PublicKeyCredentialEntry`, it is based on `R.drawable.adx_ic_password`)