我正在尝试将面部锁定与生物识别管理器集成,但它不起作用。 另外,我需要检查设备中是否支持面部锁。 让我知道有人为自定义应用程序登录集成了面部锁定。
BiometricManager biometricManager = BiometricManager.from(MainActivity.this);
switch (biometricManager.canAuthenticate()) {
case BiometricManager.BIOMETRIC_SUCCESS:
Toast.makeText(MainActivity.this, "Face Id Setup Successfully", Toast.LENGTH_LONG).show();
Log.d("Sohan", "App can authenticate using biometrics.");
break;
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
Toast.makeText(MainActivity.this, "No biometric features available on this device.", Toast.LENGTH_LONG).show();
Log.e("Sohan", "No biometric features available on this device.");
break;
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
Toast.makeText(MainActivity.this, "Biometric features are currently unavailable.", Toast.LENGTH_LONG).show();
Log.e("Sohan", "Biometric features are currently unavailable.");
break;
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
Toast.makeText(MainActivity.this, "The user hasn't associated any biometric credentials with their account.", Toast.LENGTH_LONG).show();
Log.e("Sohan", "The user hasn't associated any biometric credentials with their account.");
break;
}
您不能仅启用面部锁定,如果设备同时启用了微调和面部。生物识别管理器首先自动调用指纹。如果未启用指纹,则生物识别管理器会面子。这些是可用的选项。