CreateCredentialRequest
abstract class CreateCredentialRequest
CreateCustomCredentialRequest |
Base custom create request class for registering a credential. |
CreateDigitalCredentialRequest |
A request to save a digital credential to a holder application of the user's choice. |
CreatePasswordRequest |
A request to save the user password credential with their password provider. |
CreatePublicKeyCredentialRequest |
A request to register a passkey from the user's public key credential provider. |
CreateRestoreCredentialRequest |
A request to create a restore credential used for app restore purpose. |
Base request class for registering a credential.
An application can construct a subtype request and call CredentialManager.createCredential to launch framework UI flows to collect consent and any other metadata needed from the user to register a new user credential.
Summary
Nested types |
|---|
|
Information that may be used for display purposes when rendering UIs to collect the user consent and choice. |
Public companion functions |
|
|---|---|
CreateCredentialRequest |
@RequiresApi(value = 34)Parses the |
CreateCredentialRequest |
@RequiresApi(value = 23)Attempts to parse the raw data into one of |
Public properties |
|
|---|---|
Bundle |
the partial request data in the |
Bundle |
the request data in the |
CreateCredentialRequest.DisplayInfo |
the information to be displayed on the screen |
Boolean |
whether a create option will be automatically chosen if it is the only one available to the user |
Boolean |
true if must only be fulfilled by a system provider and false otherwise |
String? |
the origin of a different application if the request is being made on behalf of that application (Note: for API level >=34, setting a non-null value for this parameter will throw a SecurityException if android.permission.CREDENTIAL_MANAGER_SET_ORIGIN is not present) |
Boolean |
true if you prefer the operation to return immediately when there is no available passkey registration offering instead of falling back to discovering remote options, and false (preferred by default) otherwise |
String |
the credential type determined by the credential-type-specific subclass (e.g. the type for |
Public companion functions
createFrom
@RequiresApi(value = 34)
fun createFrom(request: CreateCredentialRequest): CreateCredentialRequest
Parses the request into an instance of CreateCredentialRequest.
It is recommended to construct a CreateCredentialRequest by directly instantiating a CreateCredentialRequest subclass, instead of using this API. This API should only be used by a small subset of system apps that reconstruct an existing object for user interactions such as collecting consents.
| Parameters | |
|---|---|
request: CreateCredentialRequest |
the framework CreateCredentialRequest object |
createFrom
@RequiresApi(value = 23)
fun createFrom(
type: String,
credentialData: Bundle,
candidateQueryData: Bundle,
requireSystemProvider: Boolean,
origin: String? = null
): CreateCredentialRequest
Attempts to parse the raw data into one of CreatePasswordRequest, CreatePublicKeyCredentialRequest, and CreateCustomCredentialRequest.
It is recommended to construct a CreateCredentialRequest by directly instantiating a CreateCredentialRequest subclass, instead of using this API. This API should only be used by a small subset of system apps that reconstruct an existing object for user interactions such as collecting consents.
| Parameters | |
|---|---|
type: String |
matches |
credentialData: Bundle |
matches |
candidateQueryData: Bundle |
matches |
requireSystemProvider: Boolean |
whether the request must only be fulfilled by a system provider |
origin: String? = null |
the origin of a different application if the request is being made on behalf of that application |
Public properties
candidateQueryData
val candidateQueryData: Bundle
the partial request data in the Bundle format that will be sent to the provider during the initial candidate query stage, which should not contain sensitive user credential information (note: bundle keys in the form of androidx.credentials.* are reserved for internal library use)
displayInfo
val displayInfo: CreateCredentialRequest.DisplayInfo
the information to be displayed on the screen
isAutoSelectAllowed
val isAutoSelectAllowed: Boolean
whether a create option will be automatically chosen if it is the only one available to the user
isSystemProviderRequired
val isSystemProviderRequired: Boolean
true if must only be fulfilled by a system provider and false otherwise
origin
val origin: String?
the origin of a different application if the request is being made on behalf of that application (Note: for API level >=34, setting a non-null value for this parameter will throw a SecurityException if android.permission.CREDENTIAL_MANAGER_SET_ORIGIN is not present)
preferImmediatelyAvailableCredentials
val preferImmediatelyAvailableCredentials: Boolean
true if you prefer the operation to return immediately when there is no available passkey registration offering instead of falling back to discovering remote options, and false (preferred by default) otherwise
type
val type: String
the credential type determined by the credential-type-specific subclass (e.g. the type for CreatePasswordRequest is PasswordCredential.TYPE_PASSWORD_CREDENTIAL and for CreatePublicKeyCredentialRequest is PublicKeyCredential.TYPE_PUBLIC_KEY_CREDENTIAL)