I'm trying to learn how to implement a fingerprint API.
In one of fingerprint guides, it gave me a code
@RequiresApi(api = Build.VERSION_CODES.P)
public class BiometricCallbackV28 extends BiometricPrompt.AuthenticationCallback {
private BiometricCallback biometricCallback;
public BiometricCallbackV28(BiometricCallback biometricCallback) {
this.biometricCallback = biometricCallback;
}
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
biometricCallback.onAuthenticationSuccessful();
}
@Override
public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
super.onAuthenticationHelp(helpCode, helpString);
biometricCallback.onAuthenticationHelp(helpCode, helpString);
}
@Override
public void onAuthenticationError(int errorCode, CharSequence errString) {
super.onAuthenticationError(errorCode, errString);
biometricCallback.onAuthenticationError(errorCode, errString);
}
@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
biometricCallback.onAuthenticationFailed();
}
}
But shouldn't there be a test whether the authentication passed THEN call onAuthenticationSucceeded? I don't see anywhere that calls public void onAuthenticationSucceeded. How does it know that the fingerprint matches? Who calls the method?
But shouldn't there be a test whether the authentication passed
The system knows whether the authentication passed, by comparing the scanned fingerprint against fingerprints registered by the user
I don't see anywhere that calls public void onAuthenticationSucceeded
The framework calls all of those callback methods, based on the results from the biometric hardware.