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.

Public methods

static final @NonNull RegistryManager

Creates a RegistryManager based on the given context.

final @NonNull RegisterCredentialsResponse

Registers credentials with the Credential Manager.

abstract void

Registers credentials with the Credential Manager.

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 and the verifier request 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

create

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

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-alpha01
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