小编sir*_*ius的帖子

确定是否存在生物识别硬件且用户已在Android P上注册生物识别

我被要求根据生物识别硬件的存在显示某些UI元素.对于Android 23-27我使用FingerprintManager#isHardwareDetected()FingerprintManager#hasEnrolledFingerprints().这两个都在Android 28中被弃用.

我明白,我可以用得到这个信息BiometricPrompt#authenticate(...),并在接受BiometricPrompt#BIOMETRIC_ERROR_HW_NOT_PRESENTBiometricPrompt#BIOMETRIC_ERROR_NO_BIOMETRICSBiometricPrompt.AuthenticationCallback#onAuthenticationError(int errorCode, ...)方法.但这会导致BiometricPrompt在支持设备上显示,这是不希望的.使用它CancellationSignal似乎也不是解决方案,因为我不知道何时取消提示.

有没有办法检测生物识别硬件的存在和用户注册?

android biometrics android-9.0-pie

33
推荐指数
4
解决办法
4764
查看次数

标签 统计

android ×1

android-9.0-pie ×1

biometrics ×1