答:iOS:
可以使用NJS实现,首先到百度云平台查询URL Types,然后调用canOpenURL测试
var UIApplication = plus.ios.importClass("UIApplication"); var NSURL = plus.ios.importClass("NSURL"); var app = UIApplication.sharedApplication(); var bdScheme = NSURL.URLWithString("baidumap://"); var install = app.canOpenURL(bdScheme); plus.ios.deleteObject(bdScheme); plus.ios.deleteObject(app);Android:
try { var packageName = '';//百度地图的包名 var main = plus.android.runtimeMainActivity(); var packageManager = main.getPackageManager(); var PackageManager = plus.android.importClass(packageManager); var packageInfo = packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); if (packageInfo) { //已安装 } else { //未安装 } } catch (e) { //未安装 }非常感谢,解决了我的问题!目前用com.baidu.BaiduMap作为百度地图的包名,com.autonavi.minimap为高德地图,可用,提供给网友参考
部分素材资源来源网站,本站提供免费下载,如有侵权请联系站长马上删除!