Fingerprint API 如何知道它已被调用?
How does Fingerprint API know it's been called?
我正在尝试学习如何实现指纹 API。
在其中一个指纹指南中,它给了我一个代码
@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();
}
}
但是不应该先测试一下认证是否通过然后调用onAuthenticationSucceeded吗?我没有看到任何调用 public void onAuthenticationSucceeded 的地方。它如何知道指纹匹配?谁调用该方法?
But shouldn't there be a test whether the authentication passed
系统通过扫描指纹与用户登记的指纹进行比对,判断是否通过认证
I don't see anywhere that calls public void onAuthenticationSucceeded
框架根据生物识别硬件的结果调用所有这些回调方法。
我正在尝试学习如何实现指纹 API。
在其中一个指纹指南中,它给了我一个代码
@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();
}
}
但是不应该先测试一下认证是否通过然后调用onAuthenticationSucceeded吗?我没有看到任何调用 public void onAuthenticationSucceeded 的地方。它如何知道指纹匹配?谁调用该方法?
But shouldn't there be a test whether the authentication passed
系统通过扫描指纹与用户登记的指纹进行比对,判断是否通过认证
I don't see anywhere that calls public void onAuthenticationSucceeded
框架根据生物识别硬件的结果调用所有这些回调方法。