USE_FINGERPRINT在API级别28中已弃用 [英] USE_FINGERPRINT is deprecated in API level 28

查看:1890
本文介绍了USE_FINGERPRINT在API级别28中已弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

常量USE_FINGERPRINT在API级别28中已已弃用应该使用在相同API级别中添加的更通用的USE_BIOMETRIC.

Constant USE_FINGERPRINT was deprecated in API level 28 and we should use more generic USE_BIOMETRIC which has been added in same API level.

我在清单中交换了这些常量,并且在调用FingerprintManagerCompat.from(context).isHardwareDetected()时遇到错误.

I swap these constants in my Manifest and I'm getting error when calling FingerprintManagerCompat.from(context).isHardwareDetected().

错误是:

缺少必需的权限-USE_FINGERPRINT

Missing required permission - USE_FINGERPRINT

发生这种情况是因为28.0.0-rc3支持v4库中的FingerprintManagerCompat中的@RequiresPermission("android.permission.USE_FINGERPRINT")注释.

This happens because of @RequiresPermission("android.permission.USE_FINGERPRINT") annotation in FingerprintManagerCompat in 28.0.0-rc3 support v4 lib.

这是我可以忽略并继续使用新权限的东西吗?

Is this something I can ignore and continue using new permission?

推荐答案

我也遇到了同样的问题,恕我直言,简短的答案是忽略弃用,只要您要支持您的应用中的指纹身份验证.

I've faced the same problem, imho the short answer is to ignore the deprecation, as long as you only want to support fingerprint authentication in your app.

google dev博客,因为API 28 google推出了新的 biometrics API ,从而简化了整个过程生物识别认证.它们为auth-dialog提供了一个简单的构建器.此外,它们还支持面部和虹膜检测-恕我直言,如果要支持它,只是时间问题,可能值得升级.

As stated in the google dev blog, since API 28 google comes up with the new biometrics API, which simplifies the whole process of biometrics authentication. They provide a simple builder for the auth-dialog. Additionally, they support face and iris detection, too - imho it is just a matter of time if you want to support it and probably might be worth upgrading it.

到目前为止,我发现的唯一缺点是,如果您想检查是否可用的指纹硬件,您必须启动身份验证过程以进行检查,然后等待 isHardwareDetected() .在这种情况下,如果您依赖此信息,则可能必须重新设计应用程序.之所以弃用这些方法,可能是因为它仅支持指纹,因此升级它并不是一个坏主意.

The only disadvantage I've discovered so far is that if you want to check if e.g. fingerprint hardware is available, you'll have to start the authentication process to check this out and wait for the error callback. The deprecated fingerprint API instead provides methods like isHardwareDetected() or hasEnrolledFingerprints() for this purpose. In this case, you would probably have to re-design your application, if you rely on this information. The reason for the deprecation of those methods is probably, that it only supports fingerprints, therefore it is not a bad idea to upgrade it.

Google还为API 28以下的设备提供了 compat 'androidx.biometric:biometric:1.0.0-alpha02'版本,看来,通过导入此依赖项,您可以简单地切换到USE_BIOMETRIC权限,而无需修改您的其他任何内容.应用-您将不会再受到警告的困扰.由于它仅处于alpha阶段,因此我会谨慎使用.因此,只要您不使用生物特征识别API中的任何内容,就可以简单地忽略该问题,并在想要支持其他生物特征认证方法时再次遇到该问题.

Google has also provided the compat 'androidx.biometric:biometric:1.0.0-alpha02' version for the devices below API 28, it seems that by importing this dependency, you could simply switch to USE_BIOMETRIC permission without modifying anything else in your app - you won't be bothered by the warning anymore. Since it is only in alpha stage, I would use it with care. Therefore, as long as you don't use anything from the biometrics API, you could also simply ignore the problem and face it again when you want to support additional biometric authentication methods.

编辑:现在,发布了Compat库的Beta版本'androidx.biometric:biometric:1.0.0-beta01'.有关更多信息,请在此处检查.

EDIT: Now, the beta version of compat library is released, 'androidx.biometric:biometric:1.0.0-beta01'. For more info on this, check here.

现在,compat库的稳定版本于2019年12月18日发布,``androidx.biometric:biometric:1.0.1''.有关此点击此处的更多信息.

Now, the stable version of compat library is released on December 18, 2019, 'androidx.biometric:biometric:1.0.1'. For more info on this Click here.

这篇关于USE_FINGERPRINT在API级别28中已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆