参考文档:HTML5+ API Reference
项目中需要判断是否安装了uber,这里拿uber举例 ,判断是否安装uber
if (plus.runtime.isApplicationExist({pname: 'com.ubercab.eats', //Android平台通过pname属性(包名)查询action: 'ubereats://store/browse' // iOS平台通过action属性(Scheme)进行查询})) {plus.runtime.launchApplication({pname: "com.ubercab.eats",extra: {test: "ceshi"}}, function(e) {console.log("Open system default browser failed: " + e.message);});
} else {uni.showModal({title: 'Tip',content: 'Application not installed',cancelText: 'Cancel',confirmText: "Install",success: (res) => {if (res.confirm) {if(plus.os.name == "Android"){//谷歌商店的uber下载地址plus.runtime.openURL('https://play.google.com/store/apps/details?id=com.ubercab.eats',(err) => {console.log('err', err)}, '');}else if(plus.os.name == "iOS"){//App Store下载地址plus.runtime.openURL('https://apps.apple.com/us/app/uber-eats-food-delivery/id1058959277', (err) => {console.log('err', err)}, '');}}})
}