RegistryManager
public abstract class RegistryManager
APIs for managing credential registries that are registered with the Credential Manager.
Use the APIs by constructing a RegistryManager with the create factory method.
Summary
Constants |
|
|---|---|
static final @NonNull String |
The intent action name that the Credential Manager used to find and invoke your activity when the user selects a credential that belongs to your application. |
Constants
ACTION_GET_CREDENTIAL
public static final @NonNull String ACTION_GET_CREDENTIAL
The intent action name that the Credential Manager used to find and invoke your activity when the user selects a credential that belongs to your application. Your activity will be launched and you should use the androidx.credentials.provider.PendingIntentHandler.retrieveProviderGetCredentialRequest API to retrieve information about the user selection (you can do this through androidx.credentials.registry.provider.selectedEntryId), the verifier request, and other caller app information contained in androidx.credentials.provider.ProviderGetCredentialRequest.
Next, perform the necessary steps (e.g. consent collection, credential lookup) to generate a response for the given request. Pass the result back using one of the androidx.credentials.provider.PendingIntentHandler.setGetCredentialResponse and androidx.credentials.provider.PendingIntentHandler.setGetCredentialException APIs.
Public methods
clearCredentialRegistry
public final @NonNull ClearCredentialRegistryResponse clearCredentialRegistry(@NonNull ClearCredentialRegistryRequest request)
Clear registries that were registered using the registerCredentials (Kotlin) or registerCredentialsAsync (Java) API.
| Parameters | |
|---|---|
@NonNull ClearCredentialRegistryRequest request |
the request to specify clearing configurations |
clearCredentialRegistryAsync
public abstract void clearCredentialRegistryAsync(
@NonNull ClearCredentialRegistryRequest request,
@NonNull Executor executor,
@NonNull CredentialManagerCallback<@NonNull ClearCredentialRegistryResponse, @NonNull ClearCredentialRegistryException> callback
)
Clear registries that were registered using the registerCredentials (Kotlin) or registerCredentialsAsync (Java) API.
This API uses callbacks instead of Kotlin coroutines.
| Parameters | |
|---|---|
@NonNull ClearCredentialRegistryRequest request |
the request to specify clearing configurations |
@NonNull Executor executor |
the callback will take place on this executor |
@NonNull CredentialManagerCallback<@NonNull ClearCredentialRegistryResponse, @NonNull ClearCredentialRegistryException> callback |
the callback invoked when the request succeeds or fails |
create
public static final @NonNull RegistryManager create(@NonNull Context context)
Creates a RegistryManager based on the given context.
registerCredentials
public final @NonNull RegisterCredentialsResponse registerCredentials(@NonNull RegisterCredentialsRequest request)
Registers credentials with the Credential Manager.
The registries will then be used by the Credential Manager when handling an app calling request (see androidx.credentials.CredentialManager). The Credential Manager will determine if the registry contains some credential(s) qualified as a candidate to fulfill the given request, and if so it will surface a user selector UI to collect the user decision for whether to proceed with the operation.
| Parameters | |
|---|---|
@NonNull RegisterCredentialsRequest request |
the request containing the credential data to register |
registerCredentialsAsync
public abstract void registerCredentialsAsync(
@NonNull RegisterCredentialsRequest request,
CancellationSignal cancellationSignal,
@NonNull Executor executor,
@NonNull CredentialManagerCallback<@NonNull RegisterCredentialsResponse, @NonNull RegisterCredentialsException> callback
)
Registers credentials with the Credential Manager.
This API uses callbacks instead of Kotlin coroutines.
The registries will then be used by the Credential Manager when handling an app calling request (see androidx.credentials.CredentialManager). The Credential Manager will determine if the registry contains some credential(s) qualified as a candidate to fulfill the given request, and if so it will surface a user selector UI to collect the user decision for whether to proceed with the operation.
| Parameters | |
|---|---|
@NonNull RegisterCredentialsRequest request |
the request containing the credential data to register |
CancellationSignal cancellationSignal |
an optional signal that allows for cancelling this call |
@NonNull Executor executor |
the callback will take place on this executor |
@NonNull CredentialManagerCallback<@NonNull RegisterCredentialsResponse, @NonNull RegisterCredentialsException> callback |
the callback invoked when the request succeeds or fails |