|
如果不知道另一个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
来源:https://www.cnblogs.com/lks6/p/14693390.html |