Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check if google maps app is installed in react-native iOS

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.

like image 830
bashIt Avatar asked Dec 24 '22 12:12

bashIt


1 Answers

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'); }
});
like image 160
lfkwtz Avatar answered Dec 28 '22 07:12

lfkwtz