IOS原有跳转Wi-Fi设置是”prefs:root=WIFI”,新的写法是”App-Prefs:root=WIFI”
function networkType(){
var types = {};
types[plus.networkinfo.CONNECTION_UNKNOW] = "Unknown connection";
types[plus.networkinfo.CONNECTION_NONE] = "No connection";
types[plus.networkinfo.CONNECTION_ETHERNET] = "Ethernet connection";
types[plus.networkinfo.CONNECTION_WIFI] = "WiFi connection";
types[plus.networkinfo.CONNECTION_CELL2G] = "Cellular 2G connection";
types[plus.networkinfo.CONNECTION_CELL3G] = "Cellular 3G connection";
types[plus.networkinfo.CONNECTION_CELL4G] = "Cellular 4G connection";
if (plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE || plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_UNKNOW) {
mui.toast("当前暂无网络连接,请打开数据服务!", "提示");
mui.confirm('网络出错,请检查网络配置', '温馨提示', ['退出', '设置'], function(e){
if(e.index == 0){
} else {
if(mui.os.ios){
plus.runtime.launchApplication({action:'App-Prefs:root=WIFI'}, function(e){
console.log(JSON.stringify(e));
}); //WIFI
} else {
var main = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass("android.content.Intent");
var mIntent = new Intent('android.settings.WIFI_SETTINGS');
main.startActivity(mIntent);
}
}
});
}
else {
console.log(types[plus.networkinfo.getCurrentType()]);
}
}
5 个评论
要回复文章请先登录或注册
5***@qq.com
5***@qq.com
5***@qq.com
2***@qq.com
2***@qq.com