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 attempts to create a credential through your application.

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.

Public methods

final @NonNull ClearCreationOptionsResponse

Clear creation options that were registered using the registerCreationOptions (Kotlin) or registerCreationOptionsAsync (Java) API.

abstract void

Clear creation options that were registered using the registerCreationOptions (Kotlin) or registerCreationOptionsAsync (Java) API.

final @NonNull ClearCredentialRegistryResponse

Clear registries that were registered using the registerCredentials (Kotlin) or registerCredentialsAsync (Java) API.

abstract void

Clear registries that were registered using the registerCredentials (Kotlin) or registerCredentialsAsync (Java) API.

static final @NonNull RegistryManager

Creates a RegistryManager based on the given context.

final @NonNull RegisterCreationOptionsResponse

Registers creation options with the Credential Manager.

abstract void

Registers creation options with the Credential Manager.

final @NonNull RegisterCredentialsResponse

Registers credentials with the Credential Manager.

abstract void

Registers credentials with the Credential Manager.

Constants

ACTION_CREATE_CREDENTIAL

public static final @NonNull String ACTION_CREATE_CREDENTIAL

The intent action name that the Credential Manager used to find and invoke your activity when the user attempts to create a credential through your application. Your activity will be launched and you should use the androidx.credentials.provider.PendingIntentHandler.retrieveProviderCreateCredentialRequest API to retrieve information contained in androidx.credentials.provider.ProviderCreateCredentialRequest.

Next, perform the necessary steps to generate a response for the given request. Pass the result back using one of the androidx.credentials.provider.PendingIntentHandler.setCreateCredentialResponse and androidx.credentials.provider.PendingIntentHandler.setCreateCredentialException APIs.

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

clearCreationOptions

public final @NonNull ClearCreationOptionsResponse clearCreationOptions(@NonNull ClearCreationOptionsRequest request)

Clear creation options that were registered using the registerCreationOptions (Kotlin) or registerCreationOptionsAsync (Java) API.

Parameters
@NonNull ClearCreationOptionsRequest request

the request to specify clearing configurations

clearCreationOptionsAsync

Added in 1.0.0-alpha04
public abstract void clearCreationOptionsAsync(
    @NonNull ClearCreationOptionsRequest request,
    @NonNull Executor executor,
    @NonNull CredentialManagerCallback<@NonNull ClearCreationOptionsResponse, @NonNull ClearCreationOptionsException> callback
)

Clear creation options that were registered using the registerCreationOptions (Kotlin) or registerCreationOptionsAsync (Java) API.

This API uses callbacks instead of Kotlin coroutines.

Parameters
@NonNull ClearCreationOptionsRequest request

the request to specify clearing configurations

@NonNull Executor executor

the callback will take place on this executor

@NonNull CredentialManagerCallback<@NonNull ClearCreationOptionsResponse, @NonNull ClearCreationOptionsException> callback

the callback invoked when the request succeeds or fails

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

Added in 1.0.0-alpha04
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

Added in 1.0.0-alpha04
public static final @NonNull RegistryManager create(@NonNull Context context)

Creates a RegistryManager based on the given context.

Parameters
@NonNull Context context

the context with which the RegistryManager should be associated

registerCreationOptions

public final @NonNull RegisterCreationOptionsResponse registerCreationOptions(@NonNull RegisterCreationOptionsRequest request)

Registers creation options 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 data 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 RegisterCreationOptionsRequest request

the request containing the creation options to register

registerCreationOptionsAsync

Added in 1.0.0-alpha04
public abstract void registerCreationOptionsAsync(
    @NonNull RegisterCreationOptionsRequest request,
    CancellationSignal cancellationSignal,
    @NonNull Executor executor,
    @NonNull CredentialManagerCallback<@NonNull RegisterCreationOptionsResponse, @NonNull RegisterCreationOptionsException> callback
)

Registers creation options 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.createCredential and androidx.credentials.CredentialManager.createCredentialAsync). The Credential Manager will determine if the registry contains some data 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 RegisterCreationOptionsRequest request

the request containing the creation options 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 RegisterCreationOptionsResponse, @NonNull RegisterCreationOptionsException> callback

the callback invoked when the request succeeds or fails

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

Added in 1.0.0-alpha04
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