You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android 11(API30)Biometric认证回调二次触发失效求助

Android 11(API 30)下BiometricPrompt.AuthenticationCallback不触发问题

在Android 11(API 30)版本中遇到BiometricPrompt.AuthenticationCallback()不触发的问题,仅该版本出现此问题。使用的androidx.biometric:biometric版本为1.2.0-alpha01,已尝试更新至最新版本,问题仍存在。

复现步骤

  • 显示Biometric弹窗
  • 按返回键关闭弹窗,此时onAuthenticationError被触发
  • 再次显示Biometric弹窗
  • 再次按返回键或输入正确/错误生物特征,均无认证回调触发

代码示例

val callback = object : BiometricPrompt.AuthenticationCallback() {

            override fun onAuthenticationError(errCode: Int, errString: CharSequence) {
                super.onAuthenticationError(errCode, errString)
                if (errCode == BiometricPrompt.ERROR_USER_CANCELED)
                    // user click outside or back key -> try to show biometric prompt again
            }

            override fun onAuthenticationFailed() {
                super.onAuthenticationFailed()
                processFailed()
            }

            override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
                super.onAuthenticationSucceeded(result)
            }
        }
        biometricPrompt = BiometricPrompt(activity, executor, callback)

        biometricPrompt.authenticate(promptInfo)

预期结果

至少有一个AuthenticationCallback函数被触发。

疑问

  • 是否有开发者遇到过该问题?
  • 为何二次弹窗时回调不触发?
  • 有何方法避免此场景下的弹窗关闭?

内容的提问来源于stack exchange,提问作者Tan174

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 08:27:35