CreateEntry


@RequiresApi(value = 23)
public final class CreateEntry


An entry to be shown on the selector during a create flow initiated when an app calls CredentialManager.createCredential

A 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 PendingIntent is fired, and the credential creation can be completed.

Summary

Nested types

public final class CreateEntry.Builder

A builder for CreateEntry

Public constructors

CreateEntry(
    @NonNull CharSequence accountName,
    @NonNull PendingIntent pendingIntent,
    CharSequence description,
    Instant lastUsedTime,
    Icon icon,
    Integer passwordCredentialCount,
    Integer publicKeyCredentialCount,
    Integer totalCredentialCount,
    boolean isAutoSelectAllowed
)
@RequiresApi
CreateEntry(
    @NonNull CharSequence accountName,
    @NonNull PendingIntent pendingIntent,
    CharSequence description,
    Instant lastUsedTime,
    Icon icon,
    Integer passwordCredentialCount,
    Integer publicKeyCredentialCount,
    Integer totalCredentialCount,
    boolean isAutoSelectAllowed,
    BiometricPromptData biometricPromptData
)

Public methods

static final CreateEntry

Converts a framework android.service.credentials.CreateEntry class to a Jetpack CreateEntry class

final @NonNull CharSequence

the name of the account where the credential will be saved

final 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

final CharSequence

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

final Icon

the icon to be displayed with this entry on the UI, must be created using Icon.createWithResource when possible, and especially not with Icon.createWithBitmap as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions

final 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

final Integer

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

final @NonNull PendingIntent

the PendingIntent that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request, and NOT with flag PendingIntent.FLAG_ONE_SHOT as it can be invoked multiple times

final Integer

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

final Integer

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

final boolean

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

Public constructors

CreateEntry

Added in 1.2.0
public CreateEntry(
    @NonNull CharSequence accountName,
    @NonNull PendingIntent pendingIntent,
    CharSequence description,
    Instant lastUsedTime,
    Icon icon,
    Integer passwordCredentialCount,
    Integer publicKeyCredentialCount,
    Integer totalCredentialCount,
    boolean isAutoSelectAllowed
)
Parameters
@NonNull CharSequence accountName

the name of the account where the credential will be saved

@NonNull PendingIntent pendingIntent

the PendingIntent that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request, and NOT with flag PendingIntent.FLAG_ONE_SHOT as it can be invoked multiple times

CharSequence description

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

Instant 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

Icon icon

the icon to be displayed with this entry on the UI, must be created using Icon.createWithResource when possible, and especially not with Icon.createWithBitmap as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions

Integer passwordCredentialCount

the no. of password credentials contained by the provider

Integer publicKeyCredentialCount

the no. of public key credentials contained by the provider

Integer totalCredentialCount

the total no. of credentials contained by the provider

boolean isAutoSelectAllowed

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

Throws
kotlin.IllegalArgumentException

If accountName is empty, or if description is longer than 300 characters (important: make sure your descriptions across all locales are within this limit)

kotlin.NullPointerException

If accountName or pendingIntent is null

CreateEntry

Added in 1.5.0-beta01
@RequiresApi
public CreateEntry(
    @NonNull CharSequence accountName,
    @NonNull PendingIntent pendingIntent,
    CharSequence description,
    Instant lastUsedTime,
    Icon icon,
    Integer passwordCredentialCount,
    Integer publicKeyCredentialCount,
    Integer totalCredentialCount,
    boolean isAutoSelectAllowed,
    BiometricPromptData biometricPromptData
)
Parameters
@NonNull CharSequence accountName

the name of the account where the credential will be saved

@NonNull PendingIntent pendingIntent

the PendingIntent that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request, and NOT with flag PendingIntent.FLAG_ONE_SHOT as it can be invoked multiple times

CharSequence description

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

Instant 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

Icon icon

the icon to be displayed with this entry on the UI, must be created using Icon.createWithResource when possible, and especially not with Icon.createWithBitmap as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions

Integer passwordCredentialCount

the no. of password credentials contained by the provider

Integer publicKeyCredentialCount

the no. of public key credentials contained by the provider

Integer totalCredentialCount

the total no. of credentials contained by the provider

boolean isAutoSelectAllowed

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

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

Throws
kotlin.IllegalArgumentException

If accountName is empty, or if description is longer than 300 characters (important: make sure your descriptions across all locales are within this limit)

kotlin.NullPointerException

If accountName or pendingIntent is null

Public methods

fromCreateEntry

Added in 1.5.0-beta01
public static final CreateEntry fromCreateEntry(@NonNull CreateEntry createEntry)

Converts a framework android.service.credentials.CreateEntry class to a Jetpack 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 CreateEntry to populate the BeginCreateCredentialResponse.

Parameters
@NonNull CreateEntry createEntry

the instance of framework class to be converted

getAccountName

Added in 1.2.0
public final @NonNull CharSequence getAccountName()

the name of the account where the credential will be saved

getBiometricPromptData

Added in 1.5.0-beta01
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

getDescription

Added in 1.2.0
public final CharSequence getDescription()

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

getIcon

Added in 1.2.0
public final Icon getIcon()

the icon to be displayed with this entry on the UI, must be created using Icon.createWithResource when possible, and especially not with Icon.createWithBitmap as the latter consumes more memory and may cause undefined behavior due to memory implications on internal transactions

getLastUsedTime

Added in 1.2.0
public final Instant getLastUsedTime()

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

getPasswordCredentialCount

Added in 1.2.0
public final Integer getPasswordCredentialCount()

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

getPendingIntent

Added in 1.2.0
public final @NonNull PendingIntent getPendingIntent()

the PendingIntent that will get invoked when the user selects this entry, must be created with a unique request code per entry, with flag PendingIntent.FLAG_MUTABLE to allow the Android system to attach the final request, and NOT with flag PendingIntent.FLAG_ONE_SHOT as it can be invoked multiple times

getPublicKeyCredentialCount

Added in 1.2.0
public final Integer getPublicKeyCredentialCount()

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

getTotalCredentialCount

Added in 1.2.0
public final Integer getTotalCredentialCount()

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

This total count is not necessarily equal to the sum of getPasswordCredentialCount and getPublicKeyCredentialCount.

isAutoSelectAllowed

Added in 1.2.0
public final boolean isAutoSelectAllowed()

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