我需要使用指纹和面部认证集成生物特征认证。指纹身份验证可以正常工作,但是当我仅设置人脸身份验证时,我无法从BiometricManager.from(context)方法获取生物识别信息,如下所示,

val biometricManager = BiometricManager.from(context)
    when(biometricManager.canAuthenticate()){
        BiometricManager.BIOMETRIC_SUCCESS ->{
            Log.e(TAG, "App can authenticate using biometrics.")
        }
        BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE ->{
            Log.d(TAG, "Hardware not available")
        }
        BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE ->{
            Log.d(TAG, "Biometric features are currently unavailable.")
        }
        BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED ->{
            Log.d(TAG, "The user hasn't associated any biometric credentials with their account.")
        }
        else ->{
            Log.d(TAG, "Nothing supported")
        }
    }

最佳答案

Android Biometric API仅在具有与Android Biometric堆栈兼容的生物特征(面部,指纹,虹膜)的设备上运行。我有一整套支持Face功能的设备,其中只有少数支持Android Biometrics的设备。

08-17 14:24