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(beginGetCredentialOption: BeginGetCredentialOption, slice: Slice) Creates an entry that is associated with a |
|
CredentialEntry(type: String, slice: Slice) Creates an entry that is independent of an incoming |
|
CredentialEntry(beginGetCredentialOptionId: String, type: String, slice: Slice) Creates an entry that is associated with a |
Public methods | |
---|---|
Int | |
String |
Returns the id of the |
Slice |
getSlice() Returns the |
String |
getType() 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
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
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 . |
CredentialEntry
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 |
Public methods
describeContents
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
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
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
fun getType(): String
Returns the specific credential type of the entry.
Return | |
---|---|
String |
This value cannot be null . |
writeToParcel
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 |