我尝试使用npm模块react-native-check-app-install
,但我无法实现总是结果是假的。
还尝试使用react-native-installed-apps
获取手机中安装的应用程序列表,但此返回始终为空列表。
您确定要声明URL方案吗?
完成后,您不需要额外的包来检查是否可以打开Google地图。您只需使用链接模块即可。
Linking.canOpenURL('comgooglemaps://?center=40.765819,-73.975866')
.then((canOpen) => {
if (canOpen) { console.log('open google maps'); } else { console.log('open apple maps'); }
});