【问题标题】:Android Fingerprint only allows 5 attempts at a period of timeAndroid指纹在一段时间内只允许5次尝试
【发布时间】:2016-05-11 02:53:15
【问题描述】:

我正在开发一个需要指纹才能打开 Activity 的 Android 应用。我刚刚注意到,当我使用指纹解锁手机时,在我的应用中扫描指纹的尝试次数仅为 4 次。

例如:

  • 手机已解锁

  • 使用指纹解锁手机

  • 打开我的指纹应用

  • 无法尝试扫描指纹超过 4 次

另一种情况:

  • 指纹应用已打开

  • 仅接受 5 次尝试,应用将不再尝试扫描指纹

  • 再等一段时间,一段时间内只接受5次尝试

有解决办法吗?

【问题讨论】:

    标签: android encryption fingerprint android-security android-fingerprint-api


    【解决方案1】:

    我做了一些研究,发现了Android 6.0 Compatibility Definition Document

    这在指纹传感器部分中有说明:

    具有安全锁屏的设备实现应该包括指纹传感器。如果一个设备 实现包括指纹传感器,并为第三方开发人员提供相应的 API, 它:

    必须在 5 次错误指纹尝试后限制尝试至少 30 秒 验证。

    所以.. 我想目前没有解决方法。

    【讨论】:

    【解决方案2】:

    在搜索我遇到的相同问题时遇到了这个 stackoverflow。

    无论如何,使用最新的 API BiometricPrompt,我们现在可以通过覆盖 AuthenticationCallback 来自定义行为

    BiometricPrompt.AuthenticationCallback() {
        override fun onAuthenticationError(
            errorCode: Int,
            errString: CharSequence
        ) {
            super.onAuthenticationError(errorCode, errString)
        }
    
        override fun onAuthenticationSucceeded(
            result: BiometricPrompt.AuthenticationResult
        ) {
            super.onAuthenticationSucceeded(result)
        }
    
        // called when an attempt to authenticate with biometrics fails
        // i.e. invalid fingerprint
        override fun onAuthenticationFailed() {
            super.onAuthenticationFailed()
            // keep track of a counter here and decide when to dismiss the dialog
            biometricPrompt?.cancelAuthentication()
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多