{
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;
}
Getting mac address on device api more than 10 is almost impossible. Android's new security restriction no longer allow to access mac address read here. Why do you need the mac address mention the reason might be there is some other solution that may help.