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

Builder

class Builder
kotlin.Any
   ↳ androidx.biometric.auth.CredentialAuthPrompt.Builder

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

Summary

Public constructors
<init>(@NonNull authPromptHost: AuthPromptHost, @NonNull title: CharSequence, @NonNull clientExecutor: Executor, @NonNull clientCallback: AuthPromptCallback)

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

<init>(@NonNull authPromptHost: AuthPromptHost, @NonNull title: CharSequence, @NonNull clientCallback: AuthPromptCallback)

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

Public methods
CredentialAuthPrompt

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

CredentialAuthPrompt.Builder

Optional: Sets the crypto object for the prompt.

CredentialAuthPrompt.Builder
setDescription(@NonNull description: CharSequence)

Optional: Sets the description for the prompt.

Public constructors

<init>

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

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

Parameters
authPromptHost AuthPromptHost: androidx.fragment.app.Fragment or androidx.fragment.app.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.
Return
Builder object for setting remaining optional variables of the CredentialAuthPrompt class.

<init>

Builder(
    @NonNull authPromptHost: AuthPromptHost,
    @NonNull title: CharSequence,
    @NonNull clientCallback: AuthPromptCallback)

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: androidx.fragment.app.Fragment or androidx.fragment.app.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.
Return
Builder object for setting remaining optional variables of the CredentialAuthPrompt class.

Public methods

build

@NonNull fun build(): CredentialAuthPrompt

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

Return
CredentialAuthPrompt CredentialAuthPrompt instance for starting authentication.

setCrypto

@NonNull fun setCrypto(@NonNull crypto: BiometricPrompt.CryptoObject): CredentialAuthPrompt.Builder

Optional: Sets the crypto object for the prompt.

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

setDescription

@NonNull fun setDescription(@NonNull description: CharSequence): CredentialAuthPrompt.Builder

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

Parameters
description CharSequence: The description to be displayed on the prompt.
Return
CredentialAuthPrompt.Builder This builder.