1. H5调用第三方APP
需要知道第三方app的scheme协议,使用apktool 反编译apk文件可以得到scheme,详见:https://blog.csdn.net/s13383754499/article/details/78914592
btnwx() {
console.log("微信小程序");
window.location.href = 'weixin://dl/business/?t=xxxxxxxx' //进入微信公众平台获取URL Scheme
},
btnzfb() {
console.log("支付宝小程序");
window.location.href=" alipays://platformapi/startapp?appId=2021002158616517&page=pages/index/index ";
},
btnnwzx() {
console.log("南网在线");
window.location.href = 'com.csg.palmhall://';
setTimeout(function(){
let hidden = window.document.hidden || window.document.mozHidden || window.document.msHidden ||window.document.webkitHidden
if(typeof hidden =="undefined" || hidden ==false){
//打开应用宝下载app
window.location.href =" https://a.app.qq.com/o/simple.jsp?pkgname=com.csg.palmhall&info=B50734893732C01B00F45AA098786D57 ";
}
}, 3000);
},
2. 开发安卓APP调用第三方APP
//调用微信小程序
btnwx() {
plus.runtime.openURL("weixin://dl/business/?t=RyFUbrrJcyb") //直接打开小程序主页
//plus.runtime.openURL("https://95598.csg.cn/ucs/sr/minipage/miniToCenter.html") //调用网页跳转到小程序,这种方式比较慢
},
//调用支付宝小程序
btnzfb(){
uni.getSystemInfo({
success(res) {
if(res.platform == 'android') {
plus.runtime.openURL("alipays://platformapi/startapp?appId=2019070265762435&page=pages/index/index")
}
}
})
},
btnnwzx() {
console.log("南网在线");
//判断app是否存在
if (plus.runtime.isApplicationExist({
pname: 'com.csg.palmhall'})) {
console.log("该app已安装")
//调用第三方app
plus.runtime.launchApplication({
pname: "com.csg.palmhall",
action: "com.dianyou.sdk.operationtool.DyWebActivity",
extra: {
useraccount: "00",
} //传递的参数
},
function(e) {
console.log("e", e)
uni.showToast({
title: "打开失败",
icon: "none"
})
}
)
} else {
uni.showToast({
title: "app未安装",
icon: "none"
})
//跳转到下载页面
plus.runtime.openURL('https://a.app.qq.com/o/simple.jsp?pkgname=com.csg.palmhall&info=B50734893732C01B00F45AA098786D57', function(res) {
console.log(res)
})
}
},