检查google地图应用是否安装在react-native iOS中

问题描述 投票:2回答:1

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

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

react-native react-native-ios
1个回答
4
投票

您确定要声明URL方案吗?

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

完成后,您不需要额外的包来检查是否可以打开Goog​​le地图。您只需使用链接模块即可。

Linking.canOpenURL('comgooglemaps://?center=40.765819,-73.975866')
.then((canOpen) => {
    if (canOpen) { console.log('open google maps'); } else { console.log('open apple maps'); }
});
© www.soinside.com 2019 - 2024. All rights reserved.