Android 12 Developer Preview is here! Try it out, and give us your feedback!

Class2BiometricAuthPrompt

public class Class2BiometricAuthPrompt
extends Object

java.lang.Object
   ↳ androidx.biometric.auth.Class2BiometricAuthPrompt


An authentication prompt that requires the user to present a Class 2 biometric (e.g. fingerprint, face, or iris).

Note that Class 3 biometrics are guaranteed to meet the requirements for Class 2 and thus will also be accepted.

Summary

Nested classes

class Class2BiometricAuthPrompt.Builder

Builder for a Class2BiometricAuthPrompt with configurable options. 

Public methods

CharSequence getDescription()

Gets the description to be displayed on the prompt, if set.

CharSequence getNegativeButtonText()

Gets the label text for the negative button on the prompt.

CharSequence getSubtitle()

Gets the subtitle to be displayed on the prompt, if set.

CharSequence getTitle()

Gets the title to be displayed on the prompt.

boolean isConfirmationRequired()

Checks if the prompt should require explicit user confirmation after a passive biometric (e.g.

AuthPrompt startAuthentication(AuthPromptHost host, Executor executor, AuthPromptCallback callback)

Shows an authentication prompt to the user.

AuthPrompt startAuthentication(AuthPromptHost host, AuthPromptCallback callback)

Shows an authentication prompt to the user.

Inherited methods

Public methods

getDescription

public CharSequence getDescription ()

Gets the description to be displayed on the prompt, if set.

Returns
CharSequence The description for the prompt.

getNegativeButtonText

public CharSequence getNegativeButtonText ()

Gets the label text for the negative button on the prompt.

Returns
CharSequence The negative button text for the prompt.

getSubtitle

public CharSequence getSubtitle ()

Gets the subtitle to be displayed on the prompt, if set.

Returns
CharSequence The subtitle for the prompt.

getTitle

public CharSequence getTitle ()

Gets the title to be displayed on the prompt.

Returns
CharSequence The title for the prompt.

isConfirmationRequired

public boolean isConfirmationRequired ()

Checks if the prompt should require explicit user confirmation after a passive biometric (e.g. iris or face) has been recognized but before AuthPromptCallback.onAuthenticationSucceeded(androidx.fragment.app.FragmentActivity, BiometricPrompt.AuthenticationResult) is called.

Returns
boolean Whether the prompt should require explicit user confirmation for passive biometrics.

startAuthentication

public AuthPrompt startAuthentication (AuthPromptHost host, 
                Executor executor, 
                AuthPromptCallback callback)

Shows an authentication prompt to the user.

Parameters
host AuthPromptHost: A wrapper for the component that will host the prompt.

executor Executor: The executor that will be used to run authentication callback methods.

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

Returns
AuthPrompt A handle to the shown prompt.

startAuthentication

public AuthPrompt startAuthentication (AuthPromptHost host, 
                AuthPromptCallback callback)

Shows an authentication prompt to the user.

Parameters
host AuthPromptHost: A wrapper for the component that will host the prompt.

callback AuthPromptCallback: The callback object that will receive and process authentication events. Each callback method will be run on the main thread.

Returns
AuthPrompt A handle to the shown prompt.