CredentialEntry
public final class CredentialEntry
extends Object
implements Parcelable
java.lang.Object | |
↳ | 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 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 Activity
result should be set to Activity.RESULT_OK
, and the CredentialProviderService.EXTRA_GET_CREDENTIAL_RESPONSE
must be set with a GetCredentialResponse
object.
Summary
Inherited constants |
---|
Fields | |
---|---|
public static final Creator<CredentialEntry> | CREATOR
|
Public constructors | |
---|---|
CredentialEntry(BeginGetCredentialOption beginGetCredentialOption, Slice slice) Creates an entry that is associated with a | |
CredentialEntry(String type, Slice slice) Creates an entry that is independent of an incoming | |
CredentialEntry(String beginGetCredentialOptionId, String type, Slice slice) Creates an entry that is associated with a |
Public methods | |
---|---|
int | describeContents() Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
String | getBeginGetCredentialOptionId() Returns the id of the |
Slice | getSlice() Returns the |
String | getType() Returns the specific credential type of the entry. |
void | writeToParcel(Parcel dest, int flags) Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Fields
Public constructors
CredentialEntry
public 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
public CredentialEntry (String type, 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
public CredentialEntry (String beginGetCredentialOptionId, String type, 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 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 |
Throws | |
---|---|
IllegalArgumentException | If beginGetCredentialOptionId or type is null, or empty |
Public methods
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
, the return value of this method must include the CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getBeginGetCredentialOptionId
public String getBeginGetCredentialOptionId ()
Returns the id of the BeginGetCredentialOption
for which this credential entry has been constructed.
Returns | |
---|---|
String | This value cannot be null . |
getSlice
public Slice getSlice ()
Returns the Slice
object containing UI display content to be shown for this entry.
Returns | |
---|---|
Slice | This value cannot be null . |
getType
public String getType ()
Returns the specific credential type of the entry.
Returns | |
---|---|
String | This value cannot be null . |
writeToParcel
public void writeToParcel (Parcel dest, int flags)
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.PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |