5

I tried with the npm module react-native-check-app-install but I couldn't achieved always the result is false.

Also tried with react-native-installed-apps to get the list of apps installed in the phone but this return always empty list.

bashIt
  • 1,006
  • 1
  • 10
  • 26

1 Answers1

11

Did you make sure to declare the URL schemes?

https://developers.google.com/maps/documentation/ios-sdk/start#step_6_declare_the_url_schemes_used_by_the_api

Once you've done that, you don't need an additional package to check if you can open Google Maps. You can just use the Linking module.

Linking.canOpenURL('comgooglemaps://?center=40.765819,-73.975866')
.then((canOpen) => {
    if (canOpen) { console.log('open google maps'); } else { console.log('open apple maps'); }
});
lfkwtz
  • 1,007
  • 2
  • 11
  • 25
  • 1
    Updated link for URL schemes mentioned in the answer: https://developers.google.com/maps/documentation/ios-sdk/start#step_6_declare_the_url_schemes_used_by_the_api – Abhishek Ghosh Apr 16 '19 at 21:17
  • 1
    When compiling with iOS SDK 9.0 and later, you must update your application's property list file with the following to include Waze: `LSApplicationQueriesSchemes comgooglemaps waze ` – Hamid Reza Salimian Jun 05 '19 at 09:57
  • 1
    Is it possible to just if opening google maps is installed? Without passing coordinates? For instance, does something like this ```Linking.canOpenURL('comgooglemaps://)```work? @AbhishekGhosh –  Oct 14 '20 at 13:29
  • @Jnl should definitely be possible :) – Abhishek Ghosh Oct 14 '20 at 15:09