轉載自:https://blog.csdn.net/u012442504/article/details/87367153
// 擴展API加載完畢后調用onPlusReady回調函數
document.addEventListener( "plusready", onPlusReady, false );
// 擴展API加載完畢,現在可以正常調用擴展API
function onPlusReady() {
}
// 調用第三方程序
//瀏覽器調用
function launchApp() {
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 );
} );
}
}
使用:
ios
if (mui.os.ios) {
location.href = 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=682211190&pageNumber=0&sortOrdering=2&type=&mt=8';
}
Android
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
plus.runtime.openURL("market://details?id=com.zendaccess.smartaccess", function(e) {
mui.alert("360手機助手和應用寶、華為市場、百度助手、安智市場、PP助手,你一個都沒裝,,感謝支持");
}, "com.pp.assistant"); //PP助手市場
}, "cn.goapk.market"); //安智市場
}, "com.dragon.android.pandaspace"); //百度助手市場
}, "com.huawei.appmarket"); //華為市場//
}, "com.qihoo.appstore"); //360市場
}, "com.tencent.android.qqdownloader"); //應用寶市場
}, "com.android.vending");//google play