4

i tried to check other app install in my react native project, I'm used module like: https://www.npmjs.com/package/react-native-check-app-install But always got this error: Cannot read property 'pkgName' of undefined Here is my code:

    AppInstalledChecker
    .isAppInstalledAndroid('com.skype.raider') 
    .then((isInstalled) => {
        // isInstalled is true if the app is installed or false if not 
         console.log('App Skype status: ', isInstalled);
    });

Anyone can suggest me one way so check app install in react native (both: iOS/android)

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216
  • Shouldn't it be `.isAppInstalledAndroid('skype')` instead? Since the `pkgName` is already defined in the app-list object. source: https://github.com/redpandatronicsuk/react-native-check-app-install/blob/master/app-list.js – Ray May 16 '17 at 21:46
  • I tried react-native-check-app-install and fail because it really buggy :) At first I decided to fix some bugs but at the end I just installed react-native-shared-group-preferences and forget about react-native-check-app-install :) – Stich Sep 17 '21 at 15:20

3 Answers3

3

install this

https://github.com/KjellConnelly/react-native-shared-group-preferences

and

async check() {
    try {
        await SharedGroupPreferences.isAppInstalledAndroid("com.farsitel.bazaar")
        // IF IS INSTALL
    } catch (e) {
        // IF IS NOT INSTALL
    }
}
Hamidreza Sadegh
  • 2,110
  • 30
  • 33
2
  1. Google Play considers the list of installed apps to be personal and sensitive user data.

As we are using

AppInstalledChecker
    .isAppInstalledAndroid()

method for checking app installed check, for that we have to white-list the queries in manifest.xml

Reference : https://developer.android.com/training/package-visibility

<queries>
    <package android:name="com.instagram.android"/>
    …
</queries>
  1. For adding Queries need to upgrade build gradle version: new default settings and features for package visibility in Android 11 that need to add  you must update your android gradle plugin version

Reference: How to fix "unexpected element <queries> found in <manifest>" error?

I have updated from 3.5.2 to 4.0.2

Now react-native-check-app-install module working as expected

Hope this is resolved!

0

Android

I. For app's which has deep links like 'waze://', 'mapsme://' you can use:

import { Linking } from 'react-native'
...
Linking.canOpenURL('waze://ul?ll=${latitude},${longitude}&navigate=yes')

OR

II. You can use for absolutely all apps (for example with deep links like "https://...") https://github.com/KjellConnelly/react-native-shared-group-preferences

iOS

import { Linking } from 'react-native'
...
Linking.canOpenURL(iOS_app_URL_Scheme)
...

where iOS_app_URL_Scheme you can find via Google for each separate app. Like "waze://", "comgooglemaps://", "osmandmaps://" etc

Stich
  • 2,241
  • 1
  • 14
  • 29