【问题标题】: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
【解决方案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()
}
}