首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用生物识别管理器打开面部识别

无法使用生物识别管理器打开面部识别
EN

Stack Overflow用户
提问于 2020-05-12 17:58:47
回答 1查看 243关注 0票数 1
代码语言:javascript
复制
    biometricPrompt = BiometricPrompt(this, executor,
            object : BiometricPrompt.AuthenticationCallback() {
                override fun onAuthenticationError(errorCode: Int,
                                                   errString: CharSequence) {
                    super.onAuthenticationError(errorCode, errString)
                    Toast.makeText(applicationContext,
                                    "Authentication error: $errString", Toast.LENGTH_SHORT)
                            .show()
                }

                override fun onAuthenticationSucceeded(
                        result: BiometricPrompt.AuthenticationResult) {
                    super.onAuthenticationSucceeded(result)
                    Toast.makeText(applicationContext,
                                    "Authentication succeeded!", Toast.LENGTH_SHORT)
                            .show()
                }

                override fun onAuthenticationFailed() {
                    super.onAuthenticationFailed()
                    Toast.makeText(applicationContext, "Authentication failed",
                                    Toast.LENGTH_SHORT)
                            .show()
                }
            })

    promptInfo = BiometricPrompt.PromptInfo.Builder()
            .setTitle("Biometric login for my app")
            .setSubtitle("Log in using your biometric credential")
            .setNegativeButtonText("Use account password")
            .build()

    val biometricLoginButton =
            findViewById<Button>(R.id.biometric_login)
    biometricLoginButton.setOnClickListener {
        biometricPrompt.authenticate(promptInfo)
    }

这将打开每次指纹扫描仪,如果他们是没有指纹,它会显示没有指纹添加错误。

我想打开人脸识别BioMetricPrompt。请帮助

EN

回答 1

Stack Overflow用户

发布于 2020-05-12 18:15:53

如果设备支持,生物识别API可以自动处理人脸识别功能。

您在哪台设备上测试?

当调用生物识别库的FingerPrint()时,用户在设备设置中配置的生物识别模式(人脸、身份验证)将显示在生物识别认证UI中。如果用户要在设备设置中配置人脸生物识别模式,设备应支持人脸认证(硬件驱动).Pixel 4是支持人脸认证的设备之一用户在设置中配置人脸认证,如果调用Authentication.When (),则会显示认证UI的人脸认证类型。Android 10中引入的人脸身份验证是由硬件驱动的。

注:早些时候,我认为Soli芯片是设备中必须支持Android 10生物识别APIS的,但这是错误的。我已经编辑了之前的答案,以更正我的解释。任何与Android生物识别规范兼容的设备都将支持它。https://source.android.com/security/biometric

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61748819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档