BiometricPrompt
open class BiometricPrompt
kotlin.Any | |
↳ | androidx.biometric.BiometricPrompt |
A class that manages a system-provided biometric prompt. On devices running Android 9.0 (API 28) and above, this will show a system-provided authentication prompt, using one of the device's supported biometric modalities (fingerprint, iris, face, etc). Prior to Android 9.0, this will instead show a custom fingerprint authentication dialog. The prompt will persist across configuration changes unless explicitly canceled. For security reasons, the prompt will be dismissed when the client application is no longer in the foreground.
To persist authentication across configuration changes, developers should (re)create the prompt every time the activity/fragment is created. Instantiating the prompt with a new callback early in the fragment/activity lifecycle (e.g. in onCreate()
) will allow the ongoing authentication session's callbacks to be received by the new fragment/activity instance. Note that cancelAuthentication()
should not be called, and authenticate()
does not need to be invoked during activity/fragment creation.
Summary
Nested classes | |
---|---|
abstract |
A collection of methods that may be invoked by |
open |
A container for data passed to |
open |
A wrapper class for the crypto objects supported by |
open |
A set of configurable options for how the |
Constants | |
---|---|
static Int |
Authentication type reported by |
static Int |
Authentication type reported by |
static Int |
Authentication type reported by |
static Int |
The operation was canceled because the biometric sensor is unavailable. |
static Int |
The device does not have the required authentication hardware. |
static Int |
The hardware is unavailable. |
static Int |
The operation was canceled because the API is locked out due to too many attempts. |
static Int |
The operation was canceled because |
static Int |
The user pressed the negative button. |
static Int |
The user does not have any biometrics enrolled. |
static Int |
The device does not have pin, pattern, or password set up. |
static Int |
The operation can't be completed because there is not enough device storage remaining. |
static Int |
A security vulnerability has been discovered with one or more hardware sensors. |
static Int |
The current operation has been running too long and has timed out. |
static Int |
The sensor was unable to process the current image. |
static Int |
The user canceled the operation. |
static Int |
The operation failed due to a vendor-specific error. |
Public constructors | |
---|---|
<init>(@NonNull activity: FragmentActivity, @NonNull callback: BiometricPrompt.AuthenticationCallback) Constructs a |
|
<init>(@NonNull fragment: Fragment, @NonNull callback: BiometricPrompt.AuthenticationCallback) Constructs a |
|
<init>(@NonNull activity: FragmentActivity, @NonNull executor: Executor, @NonNull callback: BiometricPrompt.AuthenticationCallback) Constructs a |
|
<init>(@NonNull fragment: Fragment, @NonNull executor: Executor, @NonNull callback: BiometricPrompt.AuthenticationCallback) Constructs a |
Public methods | |
---|---|
open Unit |
authenticate(@NonNull info: BiometricPrompt.PromptInfo, @NonNull crypto: BiometricPrompt.CryptoObject) Shows the biometric prompt to the user. |
open Unit |
authenticate(@NonNull info: BiometricPrompt.PromptInfo) Shows the biometric prompt to the user. |
open Unit |