BiometricManager

open class BiometricManager
kotlin.Any
   ↳ androidx.biometric.BiometricManager

A class that contains biometric utilities. For authentication, see BiometricPrompt. On devices running Q and above, this will query the framework's version of android.hardware.biometrics.BiometricManager. On devices P and older, this will query androidx.core.hardware.fingerprint.FingerprintManagerCompat.

Summary

Constants

static Int

The hardware is unavailable.

static Int

The user does not have any biometrics enrolled.

static Int

There is no biometric hardware.

static Int

No error detected.

Public methods

open Int

Determines if biometrics can be used, or equivalently, whether BiometricPrompt can be shown (hardware available, templates enrolled, user-enabled).

open static BiometricManager
from(@NonNull context: Context)

Constants

BIOMETRIC_ERROR_HW_UNAVAILABLE

static val BIOMETRIC_ERROR_HW_UNAVAILABLE: Int

The hardware is unavailable. Try again later.

Value: android.hardware.biometrics.BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE

BIOMETRIC_ERROR_NONE_ENROLLED

static val BIOMETRIC_ERROR_NONE_ENROLLED: Int

The user does not have any biometrics enrolled.

Value: android.hardware.biometrics.BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED

BIOMETRIC_ERROR_NO_HARDWARE

static val BIOMETRIC_ERROR_NO_HARDWARE: Int

There is no biometric hardware.

Value: android.hardware.biometrics.BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE

BIOMETRIC_SUCCESS

static val BIOMETRIC_SUCCESS: Int

No error detected.

Value: android.hardware.biometrics.BiometricManager.BIOMETRIC_SUCCESS

Public methods

canAuthenticate

open fun canAuthenticate(): Int

Determines if biometrics can be used, or equivalently, whether BiometricPrompt can be shown (hardware available, templates enrolled, user-enabled).

Return
Int: BIOMETRIC_SUCCESS if a biometric can currently be used (enrolled and available), BIOMETRIC_ERROR_NONE_ENROLLED if the user does not have any enrolled, or BIOMETRIC_ERROR_NO_HARDWARE if none are currently enabled/supported.

from

@NonNull open static fun from(@NonNull context: Context): BiometricManager
Return
BiometricManager: A BiometricManager instance with the provided context.