/** * Get Androoid device mac address * */ 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() }
Similar Posts:
- Always report uncaught error:[$ injector:modulerr ]Solutions to errors
- Code a packet sniffer in python with pcapy exte…
- Uncaught SyntaxError: Unexpected token o
- Transcoding of system.web.httputility.urlencode in C #
- How to Use Array.prototype.slice.call(arguments)
- Node.js hot overload, including operation error report and Solutions
- [Solved] exception is java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE
- [Solved] appium Error: A new session could not be created
- JS Uncaught TypeError: Cannot read property ‘style’ of undefined(…)
- Pytorch dataloader Error: RuntimeError: stack expects each tensor to be equal size, but got [4] at entry 0 and [5] at entry 1