【问题标题】:check if google maps app is installed in react-native iOS检查谷歌地图应用程序是否安装在 react-native iOS 中
【发布时间】:2017-12-05 11:20:31
【问题描述】:

我尝试使用 npm 模块react-native-check-app-install,但我无法始终实现结果为假。

还尝试使用react-native-installed-apps 获取手机中安装的应用程序列表,但返回的总是空列表。

【问题讨论】:

  • 使用react-native-installed-packages
  • 我认为它只适用于 android :thinking:
  • 是的,它只适用于安卓
  • 问题说IOS :(
  • 对不起兄弟,我发现这个npmjs.com/package/react-native-check-app-install使用isAppInstalledIOS(url)这可能有效

标签: react-native react-native-ios


【解决方案1】:

您确定声明了 URL 方案吗?

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

完成此操作后,您不需要额外的软件包来检查您是否可以打开 Google 地图。您可以只使用链接模块。

Linking.canOpenURL('comgooglemaps://?center=40.765819,-73.975866')
.then((canOpen) => {
    if (canOpen) { console.log('open google maps'); } else { console.log('open apple maps'); }
});

【讨论】:

  • 答案中提到的 URL 方案的更新链接:developers.google.com/maps/documentation/ios-sdk/…
  • 使用 iOS SDK 9.0 及更高版本编译时,您必须使用以下内容更新应用程序的属性列表文件以包含 Waze:<key>LSApplicationQueriesSchemes</key> <array> <string>comgooglemaps</string> <string>waze</string> </array>
  • 是否可以安装打开谷歌地图?不通过坐标?例如,像Linking.canOpenURL('comgooglemaps://)work 这样的事情吗? @AbhishekGhosh
  • @Jnl 绝对应该是可能的 :)
猜你喜欢
  • 1970-01-01
  • 2016-04-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-22
  • 2018-05-22
  • 2016-10-25
  • 1970-01-01
相关资源
最近更新 更多