{
try {
List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface nif : all) {
if (!nif.getName().equalsIgnoreCase("wlan0")) continue;
byte[] macBytes = nif.getHardwareAddress();
if (macBytes == null) {
macTestResultString = "";
}
}
} catch (Exception ex) {
Log.e(App.TAG, EXCEPTION + ex.getMessage());
}
return macTestResultString;
}
发布于 2021-07-21 23:04:33
在设备api上获取大于10的mac地址几乎是不可能的。安卓的新安全限制不再允许访问mac地址read here。为什么你需要mac地址提到原因可能是有一些其他的解决方案可能会有帮助。
https://stackoverflow.com/questions/68471691
复制相似问题