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

AuthPromptCallback

abstract class AuthPromptCallback
kotlin.Any
   ↳ androidx.biometric.auth.AuthPromptCallback

A collection of methods that may be invoked by an auth prompt during authentication.

Each method receives a reference to the (possibly null) activity instance that is currently hosting the prompt. This reference should be used to fetch or update any necessary activity state in order for changes to be reflected across configuration changes.

Summary

Public constructors

A collection of methods that may be invoked by an auth prompt during authentication.

Public methods
open Unit
onAuthenticationError(@Nullable activity: FragmentActivity?, errorCode: Int, @NonNull errString: CharSequence)

Called when an unrecoverable error has been encountered and authentication has stopped.

open Unit

Called when an authentication attempt by the user has been rejected.

open Unit

Called when the user has successfully authenticated.

Public constructors

<init>

AuthPromptCallback()

A collection of methods that may be invoked by an auth prompt during authentication.

Each method receives a reference to the (possibly null) activity instance that is currently hosting the prompt. This reference should be used to fetch or update any necessary activity state in order for changes to be reflected across configuration changes.

Public methods

onAuthenticationError

open fun onAuthenticationError(
    @Nullable activity: FragmentActivity?,
    errorCode: Int,
    @NonNull errString: CharSequence
): Unit

Called when an unrecoverable error has been encountered and authentication has stopped.

After this method is called, no further events will be sent for the current authentication session.

Parameters
activity FragmentActivity?: The activity that is currently hosting the prompt.
errorCode Int: An integer ID associated with the error.
errString CharSequence: A human-readable string that describes the error.

onAuthenticationFailed

open fun onAuthenticationFailed(@Nullable activity: FragmentActivity?): Unit

Called when an authentication attempt by the user has been rejected.

Parameters
activity FragmentActivity?: The activity that is currently hosting the prompt.

onAuthenticationSucceeded

open fun onAuthenticationSucceeded(
    @Nullable activity: FragmentActivity?,
    @NonNull result: BiometricPrompt.AuthenticationResult
): Unit

Called when the user has successfully authenticated.

After this method is called, no further events will be sent for the current authentication session.

Parameters
activity FragmentActivity?: The activity that is currently hosting the prompt.
result BiometricPrompt.AuthenticationResult: An object containing authentication-related data.