uniapp判断第三方应用是否存在并打开应用

//pname是包名

if(plus.runtime.isApplicationExist({pname:'com.tencent.mm',action:'weixin://'})){
console.log("应用已安装");

if ( plus.os.name == "Android" ) {
plus.runtime.launchApplication( {pname:"com.tencent.mm"
,extra:{url:""}}, function ( e ) {
//alert( "Open system default browser failed: " + e.message );
} );
} else if ( plus.os.name == "iOS" ) {
/*plus.runtime.launchApplication( {action:"http://www.html5plus.org"}, function ( e ) {
alert( "Open system default browser failed: " + e.message );
} );*/
}

}else{
console.log("应用未安装");
}

posted on 2021-10-12 09:44  Just丶随心  阅读(781)  评论(0编辑  收藏  举报

导航