android - Fingerprint API 如何知道它已被调用?
问题描述
我正在尝试学习如何实现指纹 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();
}
}
但是不应该测试身份验证是否通过 THEN 调用 onAuthenticationSucceeded 吗?我没有看到任何地方调用 public void onAuthenticationSucceeded。它怎么知道指纹匹配?谁调用方法?
解决方案
但是不应该有一个验证是否通过的测试
系统通过将扫描的指纹与用户注册的指纹进行比较来知道认证是否通过
我没有看到任何地方调用 public void onAuthenticationSucceeded
该框架会根据生物识别硬件的结果调用所有这些回调方法。
推荐阅读
- json - 在 React 中加载 JSON 文件,没有 JSON 扩展
- javascript - 为什么我的函数在遇到返回后执行剩余代码(在两个循环内返回)
- javascript - 为什么我的百分号没有在整数值旁边输出?
- python - `json.decoder.JSONDecodeError` 使用 Python 和 Flask 制作应用程序时
- office365 - 有没有办法使用 Office.js 无缝发送邮件?
- r - ggplot中的自定义边框/多边形
- javascript - 使用 Kendo Grid - onclick 需要额外单击才能调用 jquery 方法
- neo4j - 在 Neo4J 中将字符串转换为多维数组
- algorithm - 给定n个矩形坐标,求k个矩形相交的区域面积?
- javascript - 如何使用 Fabric.js 和 ASP.Net Core SignalR 实现无网络绘图?