问题
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.
回答1:
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'); }
});
来源:https://stackoverflow.com/questions/47652375/check-if-google-maps-app-is-installed-in-react-native-ios