While using Samsung Fingerprint Spass Apis
for Android I had an option(to be honest I was forced to) to ask the user for password, if fingerprint authentication was failed.
Now, when Android M provide us with native FingerPrint
API I can't find way to achieve the same functionality.
The problem is: if user failed to provide correct fingerprint 5 times, I've got FINGERPRINT_ERROR_LOCKOUT
error code from FingerprintManager
, but I have no idea how to raise dialog with backup password and what Android component is in charge for that. Please' any android expert ? Thanks. Here is my callback function piece:
@Override
public void onAuthenticationError(int errorCode, CharSequence errString) {
logger.info("Authentication error " + errorCode + " " + errString);
super.onAuthenticationError(errorCode, errString);
//5 failed attempts
if (errorCode == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT) {
//HERE SAMSUNG WAS RAISING PASSWORD DIALOG WITHOUT MY INTERVENTION
fingerprintCallback.onFinished(FingerprintCallback.STATUS_AUTHENTIFICATION_FAILED);
//30 seconds no one touched the sensor
} else if (errorCode == FingerprintManager.FINGERPRINT_ERROR_TIMEOUT) {
fingeprintCallback.onFinished(FingerprintCallback.STATUS_TIMEOUT_FAILED);
//cancellation signal cancel() was called
} else if (errorCode == FingerprintManager.FINGERPRINT_ERROR_CANCELED) {
if (!isTimeout) {
fingerprintCallback.onFinished(FingerprintCallback.STATUS_USER_CANCELLED);
}
} else {
fingerprintCallback.onFinished(FingerprintCallback.STATUS_FAILED);
}
if (fingerprintDialog != null) {
fingerprintDialog.dismiss();
}
}
To be clear - I need the phone's PIN password, the exact password the user needs to enter when he/she enters the Fingerprint Section in security settings of the device.