prscX / react-native-local-authenticate

React Native: Local Authentication
Apache License 2.0
15 stars 1 forks source link

Not working on Android #5

Open dusanjovanov opened 4 years ago

dusanjovanov commented 4 years ago

I call this function at the start of my app:

import {RNLocalAuthenticate} from 'react-native-local-authenticate';

const localAuth = async () => {
  try {
    const hasHardware = await RNLocalAuthenticate.HasHardware();
    console.log('hasHardware', hasHardware);
    if (!hasHardware) {
      await afterLoginFlow();
      return;
    }
  } catch (err) {}

  try {
    const isAuth = await RNLocalAuthenticate.Authenticate('reason');
    console.log('isAuth', isAuth);
    if (isAuth) {
      await afterLoginFlow();
    } else {
      localAuth();
    }
  } catch (err) {
    console.log('err', err);
    await localAuth();
  }
};

It works fine on IOS (except for #4 ), but on Android nothing is happening. I just get false from the Authenticate call. I've added this to my AndroidManifest.xml:

 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
 <uses-permission android:name="android.permission.USE_BIOMETRIC" />
lucaashrq commented 3 years ago

Did you found a solution?