React Native中的Android Face ID身份验证



我正在开发一款React Native Android应用程序,该应用程序需要生物识别身份验证。现在我正在使用"react native keychain"库来达到这个目的。我集成了Fingerprint,一切都很好。尽管我在设备中保存了人脸解锁,但我并没有将人脸认证作为支持的类型,只有指纹。如果我关闭设备上的指纹,那么我什么也得不到。我想知道是否有在安卓系统中实现人脸认证。如果可能的话,哪些设备支持它?我找了很多,但并没有得到明确的答案。这是"react native keychain"文档的截图react原生密钥链文档的

我的生产应用程序使用的是react native touch id,您可以尝试一下。你可以清楚地检查设备是否支持faceid,并做出相应的决定。

const optionalConfigObject = {
unifiedErrors: false // use unified error messages (default false)
passcodeFallback: false // if true is passed, itwill allow isSupported to return an error if the device is not enrolled in touch id/face id etc. Otherwise, it will just tell you what method is supported, even if the user is not enrolled.  (default false)
}

TouchID.isSupported(optionalConfigObject)
.then(biometryType => {
// Success code
if (biometryType === 'FaceID') {
console.log('FaceID is supported.');
} else {
console.log('TouchID is supported.');
}
})
.catch(error => {
// Failure code
console.log(error);
});

最新更新