【发布时间】:2021-02-02 17:16:05
【问题描述】:
我正在使用 "react-native-fingerprint-scanner": "^6.0.0" 它在模拟器上运行良好。但是当我构建 apk 时,在真实设备上进行身份验证需要花费太多时间(3 或 4 秒)。我能做什么?
这是我的代码:
const SplashBeforeFingerprint = ({ navigation }) => {
useEffect(() => {
FingerprintScanner
.authenticate({ description: 'Scan your fingerprint on the device scanner to continue' })
.then(() => {
/// nothing to do
})
.catch((error) => {
Alert.alert(
"Authentication failed",
"Your fingerprint doesn't matches! Try agin later!",
[
{
text: "Exit",
onPress: () => BackHandler.exitApp(),
style: "cancel"
},
],
{ cancelable: false });
});
}, []);
return (
<ImageBackground source={require("../img/Splash2.png")} style={styles.imageContainer} >
<View style={styles.buttonContainer} >
<AppButton style={styles.button} textStyle={styles.text} name={"Go to Home"} onPress={() => navigation.reset({
index: 2,
routes: [{ name: 'NewWallet' }],
})} />
</View>
</ImageBackground>
) }
【问题讨论】:
-
三个问题 - 1. APK 是否有可能是为调试而不是发布而构建的?调试会慢很多。 2. 设备普遍慢吗? 3. 如果指纹方式是连接外部API,会不会是设备网络问题?
-
您的问题的答案是 - 1. 它是一个签名的 APK。 2. 设备有 4GB 内存。 3.没有外部API。只有给定的代码用于指纹。 @安倍
标签: react-native