Tuesday, 6 September 2016

privacy - How to get the missing Wifi MAC Address in Android Marshmallow and later?

Android developers looking to get the Wifi MAC Address on Android M may have experienced an issue where the standard Android OS API to get the MAC Address returns a fake MAC Address (02:00:00:00:00:00) instead of the real value.



The normal way to get the Wifi MAC address is below:



final WifiManager wifiManager = (WifiManager) getApplication().getApplicationContext().getSystemService(Context.WIFI_SERVICE);


final String wifiMACaddress = wifiManager.getConnectionInfo().getMacAddress();

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...