KjellConnelly / react-native-shared-group-preferences

127 stars 57 forks source link

isAppInstallAndroid always returns False #27

Closed ajp-sourceship closed 2 years ago

ajp-sourceship commented 2 years ago

Hello all,

Much thanks for creating this package.

I'm having some issues with the example code for the isAppInstalledAndroid, for some reason it always returns false for me. I have tested this out with the following code with the instagram app and always get false for an unknown reason.

const versionNumber = parseInt(Platform.Version, 10);
    if (versionNumber >= 30) {
      const facebookPackageName = "com.instagram.android";
      // const facebookPackageName = "com.facebook.android";
      try {
        const installed = await SharedGroupPreferences.isAppInstalledAndroid(
          facebookPackageName
        );
        console.log("Facebook is installed on this device");
        osCompatible = true;
      } catch (err) {
        console.log("Facebook is not installed");
        osCompatible = false;
      }
}

Any idea what I'm doing wrong? My final use case for this is to check if ArCore is installed on an Android device and I wanted to use this package to achieve that.

Thanks in advance