SelfLender / react-native-biometrics

React Native module for iOS and Android biometrics
MIT License
664 stars 228 forks source link

How to re-ask the user for permission? #262

Open FinTech-Lab231 opened 1 year ago

FinTech-Lab231 commented 1 year ago

How to re-ask the user for permission when he initially denies the request?

const handleLoginBiometrics = async () => {
    try {
      const rnBio = new Biometrics();
      const { available } = await rnBio.isSensorAvailable();
      if (available) {
        const { success } = await rnBio.simplePrompt({ promptMessage: 'Sign in' });
        if (success) {
          navigation.reset({ index: 0, routes: [{ name: routes.home.name as never }] });
        }
      } else {}

    } catch (error) {
    }
  };
habasa commented 5 months ago

If the user initially says not to grant permission, there seem to be two ways. The first way is to delete and reinstall the app. The second is for the user to re-grant and use the face ID permission for the app in the mobile phone settings menu. Other apps also seem to have similar service flows to the second method. (for example, the MetaMask app).