我正在尝试使用带有Expo的React-native在Android上实现生物特征认证(faceID /指纹)。>
使用LocalAuthentication.authenticateAsync()
功能,用户可以通过他的生物特征进行认证。但是,如果失败,则用户必须再次按下生物特征认证。
所以我尝试了一个recursif技巧或在while循环中做,但是结果很奇怪:
const scanFingerPrint = async () => { try { const results = await DeviceService.biometricAuthentication(); if (results.success) { SecureStoreService.getCredential() .then(credentials => onScan(credentials)); } else { ShakeAnimation(animatedValueModal); return scanFingerPrint(); } } catch (e) { console.log(e); } };
使用此代码,如果用户未通过生物特征认证,它将无限期传递“其他” ...
所以我想知道如何在android上处理它。
我正在尝试使用带有Expo的React-native在Android上实现生物特征认证(faceID /指纹)。使用LocalAuthentication.authenticateAsync()函数,用户可以...
您可以使用变量手动处理它。首先在构造函数内部或作为类的属性创建变量retryCount
,以便可以在每个函数中对其进行访问。