代码之家  ›  专栏  ›  技术社区  ›  bashIt

检查谷歌地图应用程序是否安装在react native iOS中

  •  4
  • bashIt  · 技术社区  · 8 年前

    我试过npm模块 react-native-check-app-install 但我一直没能做到,结果总是假的。

    也尝试了 react-native-installed-apps 获取手机中安装的应用程序列表,但此返回始终为空列表。

    1 回复  |  直到 8 年前
        1
  •  11
  •   lfkwtz Yosvel Quintero    7 年前

    你确定要声明URL方案吗?

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

    一旦你这样做了,你就不需要额外的软件包来检查你是否可以打开谷歌地图。您可以只使用链接模块。

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