react-native-local-authenticate icon indicating copy to clipboard operation
react-native-local-authenticate copied to clipboard

Not working on Android

Open dusanjovanov opened this issue 4 years ago • 1 comments

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" />

dusanjovanov avatar Jun 18 '20 12:06 dusanjovanov

Did you found a solution?

lucaashrq avatar Aug 20 '20 22:08 lucaashrq