如果不知道另一個app的包名
安裝反編譯軟件如APKtool
包名:

啟動頁activity

調用方代碼
//判斷app是否存在
if(plus.runtime.isApplicationExist({pname:'com.inspur.jkmateriel'})){
console.log("該app已安裝")
//調用第三方app
plus.runtime.launchApplication(
{
pname:"com.inspur.jkmateriel",
action:"io.dcloud.PandoraEntry" ,
extra:{ useraccount:"xwl_hefei",}//傳遞的參數
},
function ( e ) {
console.log("e",e)
uni.showToast({
title: "打開失敗",
icon:"none"
})
} ,
);
}else{
uni.showToast({
title:"app未安裝",
icon:"none"
})
}
//只打開不需下面的代碼
---------------------------------
被調用方代碼
在app.vue的 onLaunch方法中接受參數(plus.runtime.argument)並執行相應操作
onLaunch: function() {
try {
//接受參數 extra
var cmd=plus.runtime.argument
if((cmd=="")||(cmd==undefined)){
var account=JSON.parse(cmd).useraccount
}else{
uni.reLaunch({
url:"pages/Login/login?data="+JSON.stringify(account)
})
}
} catch (e) {
uni.showToast({
title:''+e,
icon:"none"
})
}
},
————————————————
原文鏈1:https://www.cnblogs.com/by-dream/p/5157308.html
原文鏈2:https://blog.csdn.net/qq_42306286/article/details/105784002
