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

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

if ( plus.os.name == "Android" ) {
plus.runtime.launchApplication( {pname:"com.android.browser"
,extra:{url:"http://www.html5plus.org"}}, 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("应用未安装");
}

点击查看代码
if(plus.runtime.isApplicationExist({pname:'com.s,action:'weixin://'})){
console.log("应用已安装");

if ( plus.os.name == "Android" ) {
		plus.runtime.launchApplication( {pname:"com.android.browser"
			,extra:{url:"http://www.html5plus.org"}}, 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 @ 2021-12-25 16:24  蓦然JL  阅读(1746)  评论(0编辑  收藏  举报
访问主页
关注我
关注微博
私信我
返回顶部