CreateCredentialRequest
public 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 |
|---|
public final class CreateCredentialRequest.DisplayInfoInformation that may be used for display purposes when rendering UIs to collect the user consent and choice. |
Public methods |
|
|---|---|
static final @NonNull CreateCredentialRequest |
@RequiresApi(value = 34)Parses the |
static final @NonNull CreateCredentialRequest |
@RequiresApi(value = 23)Attempts to parse the raw data into one of |
final @NonNull Bundle |
the partial request data in the |
final @NonNull Bundle |
the request data in the |
final @NonNull CreateCredentialRequest.DisplayInfo |
the information to be displayed on the screen |
final 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) |
final @NonNull String |
getType()the credential type determined by the credential-type-specific subclass (e.g. the type for |
final boolean |
whether a create option will be automatically chosen if it is the only one available to the user |
final boolean |
true if must only be fulfilled by a system provider and false otherwise |
final 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 |
Public methods
createFrom
@RequiresApi(value = 34)
public static final @NonNull CreateCredentialRequest createFrom(@NonNull CreateCredentialRequest request)
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 | |
|---|---|
@NonNull CreateCredentialRequest request |
the framework CreateCredentialRequest object |
createFrom
@RequiresApi(value = 23)
public static final @NonNull CreateCredentialRequest createFrom(
@NonNull String type,
@NonNull Bundle credentialData,
@NonNull Bundle candidateQueryData,
boolean requireSystemProvider,
String origin
)
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 | |
|---|---|
@NonNull String type |
matches |
@NonNull Bundle credentialData |
matches |
@NonNull Bundle candidateQueryData |
matches |
boolean requireSystemProvider |
whether the request must only be fulfilled by a system provider |
String origin |
the origin of a different application if the request is being made on behalf of that application |
getCandidateQueryData
public final @NonNull Bundle getCandidateQueryData()
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)
getCredentialData
public final @NonNull Bundle getCredentialData()
the request data in the Bundle format
getDisplayInfo
public final @NonNull CreateCredentialRequest.DisplayInfo getDisplayInfo()
the information to be displayed on the screen
getOrigin
public final String getOrigin()
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)
getType
public final @NonNull String getType()
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)
isAutoSelectAllowed
public final boolean isAutoSelectAllowed()
whether a create option will be automatically chosen if it is the only one available to the user
isSystemProviderRequired
public final boolean isSystemProviderRequired()
true if must only be fulfilled by a system provider and false otherwise
preferImmediatelyAvailableCredentials
public final boolean preferImmediatelyAvailableCredentials()
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