android - Android 9 上的生物识别管理器

标签 android android-fingerprint-api android-biometric-prompt facial-identification android-biometric

据说 Android 9/Android P (API 28) 支持通过 BiometricPrompt 进行面部识别。我读过的所有教程都使用 BiometricManager 来检测面部识别支持 ​​- 但直到 API 29 (Android 10/Android Q) 才添加此类。

那么,我如何检测 API 28 上的面部识别支持?

我的偏好是在不使用 AndroidX 支持库的情况下执行此操作,因为我已经阅读了关于支持库版本的 BiometricManager.canAuthenticate() 结果在 API 28 及更低版本上运行时意味着什么的相互矛盾的信息。

最佳答案

回答我自己的问题。似乎即使在 Android 10 上也无法确定设备是否支持面部识别,因为如果设备支持指纹身份验证,BiometricManager.canAuthenticate() 将返回成功.来自 API Docs :

This is the equivalent of canAuthenticate(int) with Authenticators#BIOMETRIC_WEAK

并且 BiometricManager.canAuthenticate(int) 在 API 30 之前不可用。

因此,在 Android 10 上使用 BiometricManager 与使用已弃用的 FingerprintManager 没有什么不同。

所以回到我关于 Android 9 上的 BiometricManager 支持的问题。运行时使用 FingerprintManagerBiometricManager 没有区别在 Android 9 设备上。因此,BiometricManager 的等效项是 FingerprintManager

但这对像我这样正在寻找一种方法来确定设备是否支持面部识别的人没有帮助。似乎没有任何方法可以确定这个 Android 11 之前的版本。

关于android - Android 9 上的生物识别管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62430155/

相关文章:

android - 没有 ActionBar 的汉堡包图标没有透明操作栏

android - Android平台如何查看init.rc(init进程)的输出?

Android 使用指纹扫描仪作为生物识别设备

证书指纹无效?

Android 某些设备上的 Flutter local_auth 问题

Android BiometricPrompt : Cannot resolve symbol PromptInfo

android - 找不到 android.security.identity.IdentityCredential 的类文件

Android:如何确定触摸事件在 TextView 中的位置的字符索引?

三星 Note 4 的 Android FingerPrint API isHardwareDetected 返回 false

android - 如何从 onContextItemSelected 确定项目属于哪个类