/**
* 获取Androoid设备mac地址
* */
function getMacAddress(){
var net = plus.android.importClass("java.net.NetworkInterface")
console.log('mac', net)
var wl0 = net.getByName('wlan0')
var macByte = wl0.getHardwareAddress()
var str = ''
for (var i = 0; i < macByte.length; i++) {
var tmp = "";
var num = macByte[i];
if (num < 0) {
tmp =(255+num+1).toString(16);
} else {
tmp = num.toString(16);
}
if (tmp.length == 1) {
tmp = "0" + tmp;
}
if(i == macByte.length-1){
str += tmp;
}else{
str = str + tmp + "-";
}
}
console.log('mac', str.toUpperCase())
return str.toUpperCase()
}
吾日三省吾身,脚踏实地~