Added in API level 34

CredentialEntry


class CredentialEntry : Parcelable
kotlin.Any
   ↳ android.service.credentials.CredentialEntry

A credential entry that is to be displayed on the account selector that is presented to the user.

If user selects this entry, the corresponding PendingIntent, set on the slice will be invoked to launch activities that require some user engagement before getting the credential corresponding to this entry, e.g. authentication, confirmation etc. The extras associated with the resulting android.app.Activity will also contain the complete credential request containing all required parameters. This request can be retrieved against CredentialProviderService#EXTRA_GET_CREDENTIAL_REQUEST. Once the activity fulfills the required user engagement, the android.app.Activity result should be set to android.app.Activity#RESULT_OK, and the CredentialProviderService#EXTRA_GET_CREDENTIAL_RESPONSE must be set with a GetCredentialResponse object.

Summary

Inherited constants
Public constructors
CredentialEntry(beginGetCredentialOptionId: String, type: String, slice: Slice)

Creates an entry that is associated with a BeginGetCredentialOption request.

CredentialEntry(beginGetCredentialOption: BeginGetCredentialOption, slice: Slice)

Creates an entry that is associated with a BeginGetCredentialOption request.

CredentialEntry(type: String, slice: Slice)

Creates an entry that is independent of an incoming BeginGetCredentialOption request.

Public methods
Int

String

Returns the id of the BeginGetCredentialOption for which this credential entry has been constructed.

Slice

Returns the Slice object containing UI display content to be shown for this entry.

String

Returns the specific credential type of the entry.

Unit
writeToParcel(dest: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<CredentialEntry!>

Public constructors

CredentialEntry

Added in API level 34
CredentialEntry(
    beginGetCredentialOptionId: String,
    type: String,
    slice: Slice)

Creates an entry that is associated with a BeginGetCredentialOption request. Providers must use this constructor when they extend from CredentialProviderService to respond to query phase CredentialProviderService#onBeginGetCredential credential retrieval requests.

Parameters
beginGetCredentialOptionId String: the beginGetCredentialOptionId to be retrieved from BeginGetCredentialOption#getId() - the request option for which this CredentialEntry is being constructed This helps maintain an association such that when the user selects this entry, providers can receive the complete corresponding GetCredentialRequest. This value cannot be null.
type String: the type of the credential for which this credential entry is being created This value cannot be null.
slice Slice: the slice containing the metadata to be shown on the UI, must be constructed through the androidx.credentials.provider Jetpack library; If constructed manually, the slice object must contain the non-null properties of the androidx.credentials.provider.CredentialEntry class populated as slice items against specific hints as used in the class's toSlice method, since the Android System uses this library to parse the slice and extract the required attributes
Exceptions
java.lang.IllegalArgumentException If beginGetCredentialOptionId or type is null, or empty

CredentialEntry

Added in API level 34
CredentialEntry(
    beginGetCredentialOption: BeginGetCredentialOption,
    slice: Slice)

Creates an entry that is associated with a BeginGetCredentialOption request. Providers must use this constructor when they extend from CredentialProviderService to respond to query phase CredentialProviderService#onBeginGetCredential credential retrieval requests.

Parameters
beginGetCredentialOption BeginGetCredentialOption: the request option for which this credential entry is being constructed This helps maintain an association, such that when the user selects this entry, providers can receive the complete corresponding request. This value cannot be null.
slice Slice: the slice containing the metadata to be shown on the UI. Must be constructed through the androidx.credentials jetpack library. This value cannot be null.

CredentialEntry

Added in API level 34
CredentialEntry(
    type: String,
    slice: Slice)

Creates an entry that is independent of an incoming BeginGetCredentialOption request. Providers must use this constructor for constructing entries to be registered with the framework outside of the span of an API call.

Parameters
type String: the type of the credential This value cannot be null.
slice Slice: the slice containing the metadata to be shown on the UI. Must be constructed through the androidx.credentials jetpack library. This value cannot be null.

Public methods

describeContents

Added in API level 34
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getBeginGetCredentialOptionId

Added in API level 34
fun getBeginGetCredentialOptionId(): String

Returns the id of the BeginGetCredentialOption for which this credential entry has been constructed.

Return
String This value cannot be null.

getSlice

Added in API level 34
fun getSlice(): Slice

Returns the Slice object containing UI display content to be shown for this entry.

Return
Slice This value cannot be null.

getType

Added in API level 34
fun getType(): String

Returns the specific credential type of the entry.

Return
String This value cannot be null.

writeToParcel

Added in API level 34
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 34
static val CREATOR: Parcelable.Creator<CredentialEntry!>