Android APIs
public class

FingerprintManager

extends Object
java.lang.Object
   ↳ android.hardware.fingerprint.FingerprintManager

Class Overview

A class that coordinates access to the fingerprint hardware.

Use getSystemService(java.lang.String) with argument FINGERPRINT_SERVICE to get an instance of this class.

Summary

Nested Classes
class FingerprintManager.AuthenticationCallback Callback structure provided to authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
class FingerprintManager.AuthenticationResult Container for callback data from authenticate(CryptoObject, CancellationSignal, int, AuthenticationCallback, Handler)
class FingerprintManager.CryptoObject A wrapper class for the crypto objects supported by FingerprintManager. 
Constants
int FINGERPRINT_ACQUIRED_GOOD The image acquired was good.
int FINGERPRINT_ACQUIRED_IMAGER_DIRTY The fingerprint image was too noisy due to suspected or detected dirt on the sensor.
int FINGERPRINT_ACQUIRED_INSUFFICIENT The fingerprint image was too noisy to process due to a detected condition (i.e.
int FINGERPRINT_ACQUIRED_PARTIAL Only a partial fingerprint image was detected.
int FINGERPRINT_ACQUIRED_TOO_FAST The fingerprint image was incomplete due to quick motion.
int FINGERPRINT_ACQUIRED_TOO_SLOW The fingerprint image was unreadable due to lack of motion.
int FINGERPRINT_ERROR_CANCELED The operation was canceled because the fingerprint sensor is unavailable.
int FINGERPRINT_ERROR_HW_UNAVAILABLE The hardware is unavailable.
int FINGERPRINT_ERROR_LOCKOUT The operation was canceled because the API is locked out due to too many attempts.
int FINGERPRINT_ERROR_NO_SPACE Error state returned for operations like enrollment; the operation cannot be completed because there's not enough storage remaining to complete the operation.
int FINGERPRINT_ERROR_TIMEOUT Error state returned when the current request has been running too long.
int FINGERPRINT_ERROR_UNABLE_TO_PROCESS Error state returned when the sensor was unable to process the current image.
Public Methods
void authenticate(FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler)
Request authentication of a crypto object.
boolean hasEnrolledFingerprints()
Determine if there is at least one fingerprint enrolled.
boolean isHardwareDetected()
Determine if fingerprint hardware is present and functional.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int FINGERPRINT_ACQUIRED_GOOD

Added in API level 23

The image acquired was good.

Constant Value: 0 (0x00000000)

public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY

Added in API level 23

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.

Constant Value: 3 (0x00000003)

public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT

Added in API level 23

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).

Constant Value: 2 (0x00000002)

public static final int FINGERPRINT_ACQUIRED_PARTIAL

Added in API level 23

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."

Constant Value: 1 (0x00000001)

public static final int FINGERPRINT_ACQUIRED_TOO_FAST

Added in API level 23

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.

Constant Value: 5 (0x00000005)

public static final int FINGERPRINT_ACQUIRED_TOO_SLOW

Added in API level 23

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

Constant Value: 4 (0x00000004)

public static final int FINGERPRINT_ERROR_CANCELED

Added in API level 23

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.

Constant Value: 5 (0x00000005)

public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE

Added in API level 23

The hardware is unavailable. Try again later.

Constant Value: 1 (0x00000001)

public static final int FINGERPRINT_ERROR_LOCKOUT

Added in API level 23

The operation was canceled because the API is locked out due to too many attempts.

Constant Value: 7 (0x00000007)

public static final int FINGERPRINT_ERROR_NO_SPACE

Added in API level 23

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

Constant Value: 4 (0x00000004)

public static final int FINGERPRINT_ERROR_TIMEOUT

Added in API level 23

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.

Constant Value: 3 (0x00000003)

public static final int FINGERPRINT_ERROR_UNABLE_TO_PROCESS

Added in API level 23

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

Constant Value: 2 (0x00000002)

Public Methods

public void authenticate (FingerprintManager.CryptoObject crypto, CancellationSignal cancel, int flags, FingerprintManager.AuthenticationCallback callback, Handler handler)

Added in API level 23

Request authentication of a crypto object. This call warms up the fingerprint hardware and starts scanning for a fingerprint. It terminates when onAuthenticationError(int, CharSequence) or {@link 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.

Parameters
crypto object associated with the call or null if none required.
cancel an object that can be used to cancel authentication
flags optional flags; should be 0
callback an object to receive authentication events
handler an optional handler to handle callback events
Throws
IllegalArgumentException if the crypto operation is not supported or is not backed by Android Keystore facility.
IllegalStateException if the crypto primitive is not initialized.

public boolean hasEnrolledFingerprints ()

Added in API level 23

Determine if there is at least one fingerprint enrolled.

Returns
  • true if at least one fingerprint is enrolled, false otherwise

public boolean isHardwareDetected ()

Added in API level 23

Determine if fingerprint hardware is present and functional.

Returns
  • true if hardware is present and functional, false otherwise.