Freigeben über


BiometricManager.GetLastAuthenticationTime Method

Definition

Gets the last time the user successfully authenticated using one of the given authenticators.

[Android.Runtime.Register("getLastAuthenticationTime", "(I)J", "GetGetLastAuthenticationTime_IHandler", ApiSince=35)]
[Android.Runtime.RequiresPermission("android.permission.USE_BIOMETRIC")]
public virtual long GetLastAuthenticationTime (Android.Hardware.Biometrics.BiometricManagerAuthenticators authenticators);
[<Android.Runtime.Register("getLastAuthenticationTime", "(I)J", "GetGetLastAuthenticationTime_IHandler", ApiSince=35)>]
[<Android.Runtime.RequiresPermission("android.permission.USE_BIOMETRIC")>]
abstract member GetLastAuthenticationTime : Android.Hardware.Biometrics.BiometricManagerAuthenticators -> int64
override this.GetLastAuthenticationTime : Android.Hardware.Biometrics.BiometricManagerAuthenticators -> int64

Parameters

authenticators
BiometricManagerAuthenticators

bit field consisting of constants defined in Authenticators.

Returns

the time of last authentication or BiometricManager#BIOMETRIC_NO_AUTHENTICATION

Attributes

Remarks

Gets the last time the user successfully authenticated using one of the given authenticators. The returned value is time in android.os.SystemClock#elapsedRealtime SystemClock.elapsedRealtime() (time since boot, including sleep).

BiometricManager#BIOMETRIC_NO_AUTHENTICATION is returned in the case where there has been no successful authentication using any of the given authenticators since boot.

Currently, only Authenticators#DEVICE_CREDENTIAL and Authenticators#BIOMETRIC_STRONG are accepted. IllegalArgumentException will be thrown if authenticators contains other authenticator types.

Note that this may return successful authentication times even if the device is currently locked. You may use KeyguardManager#isDeviceLocked() to determine if the device is unlocked or not. Additionally, this method may return valid times for an authentication method that is no longer available. For instance, if the user unlocked the device with a Authenticators#BIOMETRIC_STRONG authenticator but then deleted that authenticator (e.g., fingerprint data), this method will still return the time of that unlock for Authenticators#BIOMETRIC_STRONG if it is the most recent successful event. The caveat is that BiometricManager#BIOMETRIC_NO_AUTHENTICATION will be returned if the device no longer has a secure lock screen at all, even if there were successful authentications performed before the lock screen was made insecure.

Java documentation for android.hardware.biometrics.BiometricManager.getLastAuthenticationTime(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to