Google is committed to advancing racial equity for Black communities. See how.

CredentialAuthPrompt.Builder

public static final class CredentialAuthPrompt.Builder
extends Object

java.lang.Object
   ↳ androidx.biometric.auth.CredentialAuthPrompt.Builder


Builder to configure a BiometricPrompt object for device credential only authentication with specified options.

Summary

Public constructors

Builder(AuthPromptHost authPromptHost, CharSequence title, Executor clientExecutor, AuthPromptCallback clientCallback)

A builder used to set individual options for the CredentialAuthPrompt class to construct a BiometricPrompt for device credential authentication.

Builder(AuthPromptHost authPromptHost, CharSequence title, AuthPromptCallback clientCallback)

A builder used to set individual options for the CredentialAuthPrompt class to construct a BiometricPrompt for device credential authentication.

Public methods

CredentialAuthPrompt build()

Configures a BiometricPrompt object with the specified options, and returns a CredentialAuthPrompt instance that can be used for starting authentication.

CredentialAuthPrompt.Builder setCrypto(BiometricPrompt.CryptoObject crypto)

Optional: Sets the crypto object for the prompt.

CredentialAuthPrompt.Builder setDescription(CharSequence description)

Optional: Sets the description for the prompt.

Inherited methods

Public constructors

Builder

public Builder (AuthPromptHost authPromptHost, 
                CharSequence title, 
                Executor clientExecutor, 
                AuthPromptCallback clientCallback)

A builder used to set individual options for the CredentialAuthPrompt class to construct a BiometricPrompt for device credential authentication.

Parameters
authPromptHost AuthPromptHost: Fragment or FragmentActivity to host the authentication prompt

title CharSequence: The title to be displayed on the prompt.

clientExecutor Executor: The executor that will run authentication callback methods.

clientCallback AuthPromptCallback: The object that will receive and process authentication events.

Returns
Builder object for setting remaining optional variables of the CredentialAuthPrompt class.

Builder

public Builder (AuthPromptHost authPromptHost, 
                CharSequence title, 
                AuthPromptCallback clientCallback)

A builder used to set individual options for the CredentialAuthPrompt class to construct a BiometricPrompt for device credential authentication. Sets mClientExecutor to new DefaultExecutor() object.

Parameters
authPromptHost AuthPromptHost: Fragment or FragmentActivity to host the authentication prompt

title CharSequence: The title to be displayed on the prompt.

clientCallback AuthPromptCallback: The object that will receive and process authentication events.

Returns
Builder object for setting remaining optional variables of the CredentialAuthPrompt class.

Public methods

build

public CredentialAuthPrompt build ()

Configures a BiometricPrompt object with the specified options, and returns a CredentialAuthPrompt instance that can be used for starting authentication.

Returns
CredentialAuthPrompt CredentialAuthPrompt instance for starting authentication.

setCrypto

public CredentialAuthPrompt.Builder setCrypto (BiometricPrompt.CryptoObject crypto)

Optional: Sets the crypto object for the prompt.

Parameters
crypto BiometricPrompt.CryptoObject: A crypto object to be associated with this authentication.

Returns
CredentialAuthPrompt.Builder

setDescription

public CredentialAuthPrompt.Builder setDescription (CharSequence description)

Optional: Sets the description for the prompt. Defaults to null.

Parameters
description CharSequence: The description to be displayed on the prompt.

Returns
CredentialAuthPrompt.Builder This builder.