检查谷歌地图应用程序是否安装在 react-native iOS 中 [英] check if google maps app is installed in react-native iOS
本文介绍了检查谷歌地图应用程序是否安装在 react-native iOS 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用 npm 模块 react-native-check-app-install
但我无法实现,结果总是错误.
I tried with the npm module react-native-check-app-install
but I couldn't achieved always the result is false.
还尝试使用 react-native-installed-apps
来获取手机中安装的应用列表,但返回的总是空列表.
Also tried with react-native-installed-apps
to get the list of apps installed in the phone but this return always empty list.
推荐答案
你确定声明了 URL 方案吗?
Did you make sure to declare the URL schemes?
完成此操作后,您不需要额外的软件包来检查是否可以打开 Google 地图.您可以只使用链接模块.
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'); }
});
这篇关于检查谷歌地图应用程序是否安装在 react-native iOS 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文