Added in API level 23
Deprecated in API level 28

FingerprintManager


open class FingerprintManager
kotlin.Any
   ↳ android.hardware.fingerprint.FingerprintManager

A class that coordinates access to the fingerprint hardware.
Requires the PackageManager#FEATURE_FINGERPRINT feature which can be detected using PackageManager.hasSystemFeature(String).

Summary

Nested classes
abstract

Callback structure provided to FingerprintManager#authenticate(CryptoObject,.

open

Container for callback data from FingerprintManager#authenticate(CryptoObject,.

A wrapper class for the crypto objects supported by FingerprintManager.

Constants
static Int

The image acquired was good.

static Int

The fingerprint image was too noisy due to suspected or detected dirt on the sensor.

static Int

The fingerprint image was too noisy to process due to a detected condition (i.e. dry skin) or a possibly dirty sensor (See

static Int

Only a partial fingerprint image was detected.

static Int

The fingerprint image was incomplete due to quick motion.

static Int

The fingerprint image was unreadable due to lack of motion.

static Int

The operation was canceled because the fingerprint sensor is unavailable.

static Int

The device does not have a fingerprint sensor.

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 FINGERPRINT_ERROR_LOCKOUT occurred too many times.

static Int

The user does not have any fingerprints enrolled.

static Int

Error state returned for operations like enrollment; the operation cannot be completed because there's not enough storage remaining to complete the operation.

static Int

Error state returned when the current request has been running too long.

static Int

Error state returned when the sensor was unable to process the current image.

static Int

The user canceled the operation.

static Int

Hardware vendors may extend this list if there are conditions that do not fall under one of the above categories.

Public methods
open Unit

Request authentication of a crypto object.

open Boolean

Determine if there is at least one fingerprint enrolled.

open Boolean

Determine if fingerprint hardware is present and functional.

Constants

FINGERPRINT_ACQUIRED_GOOD

static val FINGERPRINT_ACQUIRED_GOOD: Int

The image acquired was good.

Value: 0

FINGERPRINT_ACQUIRED_IMAGER_DIRTY

static val FINGERPRINT_ACQUIRED_IMAGER_DIRTY: Int

The fingerprint image was too noisy due to suspected or detected dirt on the sensor. For example, it's reasonable return this after multiple FINGERPRINT_ACQUIRED_INSUFFICIENT or actual detection of dirt on the sensor (stuck pixels, swaths, etc.). The user is expected to take action to clean the sensor when this is returned.

Value: 3

FINGERPRINT_ACQUIRED_INSUFFICIENT

static val FINGERPRINT_ACQUIRED_INSUFFICIENT: Int

The fingerprint image was too noisy to process due to a detected condition (i.e. dry skin) or a possibly dirty sensor (See FINGERPRINT_ACQUIRED_IMAGER_DIRTY).

Value: 2

FINGERPRINT_ACQUIRED_PARTIAL

static val FINGERPRINT_ACQUIRED_PARTIAL: Int

Only a partial fingerprint image was detected. During enrollment, the user should be informed on what needs to happen to resolve this problem, e.g. "press firmly on sensor."

Value: 1

FINGERPRINT_ACQUIRED_TOO_FAST

static val FINGERPRINT_ACQUIRED_TOO_FAST: Int

The fingerprint image was incomplete due to quick motion. While mostly appropriate for linear array sensors, this could also happen if the finger was moved during acquisition. The user should be asked to move the finger slower (linear) or leave the finger on the sensor longer.

Value: 5

FINGERPRINT_ACQUIRED_TOO_SLOW

static val FINGERPRINT_ACQUIRED_TOO_SLOW: Int

The fingerprint image was unreadable due to lack of motion. This is most appropriate for linear array sensors that require a swipe motion.

Value: 4

FINGERPRINT_ERROR_CANCELED

static val FINGERPRINT_ERROR_CANCELED: Int

The operation was canceled because the fingerprint sensor is unavailable. For example, this may happen when the user is switched, the device is locked or another pending operation prevents or disables it.

Value: 5

FINGERPRINT_ERROR_HW_NOT_PRESENT

static val FINGERPRINT_ERROR_HW_NOT_PRESENT: Int

The device does not have a fingerprint sensor.

Value: 12

FINGERPRINT_ERROR_HW_UNAVAILABLE

static val FINGERPRINT_ERROR_HW_UNAVAILABLE: Int

The hardware is unavailable. Try again later.

Value: 1

FINGERPRINT_ERROR_LOCKOUT

static val FINGERPRINT_ERROR_LOCKOUT: Int

The operation was canceled because the API is locked out due to too many attempts. This occurs after 5 failed attempts, and lasts for 30 seconds.

Value: 7

FINGERPRINT_ERROR_LOCKOUT_PERMANENT

static val FINGERPRINT_ERROR_LOCKOUT_PERMANENT: Int

The operation was canceled because FINGERPRINT_ERROR_LOCKOUT occurred too many times. Fingerprint authentication is disabled until the user unlocks with strong authentication (PIN/Pattern/Password)

Value: 9

FINGERPRINT_ERROR_NO_FINGERPRINTS

static val FINGERPRINT_ERROR_NO_FINGERPRINTS: Int

The user does not have any fingerprints enrolled.

Value: 11

FINGERPRINT_ERROR_NO_SPACE

static val FINGERPRINT_ERROR_NO_SPACE: Int

Error state returned for operations like enrollment; the operation cannot be completed because there's not enough storage remaining to complete the operation.

Value: 4

FINGERPRINT_ERROR_TIMEOUT

static val FINGERPRINT_ERROR_TIMEOUT: Int

Error state returned when the current request has been running too long. This is intended to prevent programs from waiting for the fingerprint sensor indefinitely. The timeout is platform and sensor-specific, but is generally on the order of 30 seconds.

Value: 3

FINGERPRINT_ERROR_UNABLE_TO_PROCESS

static val FINGERPRINT_ERROR_UNABLE_TO_PROCESS: Int

Error state returned when the sensor was unable to process the current image.

Value: 2

FINGERPRINT_ERROR_USER_CANCELED

static val FINGERPRINT_ERROR_USER_CANCELED: Int

The user canceled the operation. Upon receiving this, applications should use alternate authentication (e.g. a password). The application should also provide the means to return to fingerprint authentication, such as a "use fingerprint" button.

Value: 10

FINGERPRINT_ERROR_VENDOR

static val FINGERPRINT_ERROR_VENDOR: Int

Hardware vendors may extend this list if there are conditions that do not fall under one of the above categories. Vendors are responsible for providing error strings for these errors. These messages are typically reserved for internal operations such as enrollment, but may be used to express vendor errors not covered by the ones in fingerprint.h. Applications are expected to show the error message string if they happen, but are advised not to rely on the message id since they will be device and vendor-specific

Value: 8

Public methods

authenticate

Added in API level 23
open fun authenticate(
    crypto: FingerprintManager.CryptoObject?,
    cancel: CancellationSignal?,
    flags: Int,
    callback: FingerprintManager.AuthenticationCallback,
    handler: Handler?
): Unit

Deprecated: See BiometricPrompt#authenticate(CancellationSignal, Executor, and BiometricPrompt#authenticate(

Request authentication of a crypto object. This call warms up the fingerprint hardware and starts scanning for a fingerprint. It terminates when AuthenticationCallback#onAuthenticationError(int, CharSequence) or AuthenticationCallback#onAuthenticationSucceeded(AuthenticationResult) is called, at which point the object is no longer valid. The operation can be canceled by using the provided cancel object.
Requires android.Manifest.permission#USE_BIOMETRIC or android.Manifest.permission#USE_FINGERPRINT

Parameters
crypto FingerprintManager.CryptoObject?: object associated with the call or null if none required.
cancel CancellationSignal?: an object that can be used to cancel authentication This value may be null.
flags Int: optional flags; should be 0
callback FingerprintManager.AuthenticationCallback: an object to receive authentication events This value cannot be null.
handler Handler?: an optional handler to handle callback events This value may be null.
Exceptions
java.lang.IllegalArgumentException if the crypto operation is not supported or is not backed by Android Keystore facility.
java.lang.IllegalStateException if the crypto primitive is not initialized.

hasEnrolledFingerprints

Added in API level 23
open fun hasEnrolledFingerprints(): Boolean

Deprecated: See BiometricPrompt and FingerprintManager#FINGERPRINT_ERROR_NO_FINGERPRINTS

Determine if there is at least one fingerprint enrolled.
Requires android.Manifest.permission#USE_FINGERPRINT

Return
Boolean true if at least one fingerprint is enrolled, false otherwise

isHardwareDetected

Added in API level 23
open fun isHardwareDetected(): Boolean

Deprecated: See BiometricPrompt and FingerprintManager#FINGERPRINT_ERROR_HW_UNAVAILABLE

Determine if fingerprint hardware is present and functional.
Requires android.Manifest.permission#USE_FINGERPRINT

Return
Boolean true if hardware is present and functional, false otherwise.