I have an Android application that works on a single phone. In order to work on a single device, I need to get the MAC address or Android ID. I decided to get the MAC address because the app needs to connect on a specified WiFi network.
How to get the MAC address from an Android device?
WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = manager.getConnectionInfo();
String address = info.getMacAddress();
Currently I'm using this but it is not stable.
When the app restarts, it returns 02:00:00:00:00:00.
and crashes.