如何解决当 IRIS 扫描仪无法验证用户身份时,没有收到任何回调
当 IRIS 扫描器无法对用户进行身份验证时,不调用 Android Biometric API 上的任何回调( onAuthenticationError 或 onAuthenticationFailed )。
安卓版本:10, 三星 S9,一个 UI 2.1
SDK:androidx.biometric:biometric:1.2.0-alpha01 (https://github.com/android/security-samples/issues/73)
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Executor executor = ContextCompat.getMainExecutor(this);
BiometricPrompt biometricPrompt = new BiometricPrompt(MainActivity.this,executor,new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationError(int errorCode,@NonNull CharSequence errString) {
super.onAuthenticationError(errorCode,errString);
Toast.makeText(getApplicationContext(),"Authentication error: " + errString + errorCode,Toast.LENGTH_SHORT)
.show();
}
@Override
public void onAuthenticationSucceeded(
@NonNull BiometricPrompt.AuthenticationResult result) {
super.onAuthenticationSucceeded(result);
Toast.makeText(getApplicationContext(),"Authentication succeeded!",Toast.LENGTH_SHORT).show();
}
@Override
public void onAuthenticationFailed() {
super.onAuthenticationFailed();
Toast.makeText(getApplicationContext(),"Authentication failed",Toast.LENGTH_SHORT)
.show();
}
});
BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder()
.setTitle("Biometric login for my app")
.setSubtitle("Log in using your biometric credential")
.setNegativeButtonText("Use account password")
.setConfirmationRequired(true)
.setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG)
.build();
BiometricManager biometricManager = BiometricManager.from(this);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。