I wrote the following code to get the MAC address:
WifiManager wimanager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
String address = wimanager.getConnectionInfo().getMacAddress();
Log.d("TOKEN", address);
This works perfectly on my phone, but in the Android emulator it returns null. Is this because the Android emulator doesn't have a MAC address?
It's the same as when you try getting a hold of the bluetooth stuff on the emulator. There is no MacAdress and should return null. Try on a real device and it will work. The code is correct.
See this post where I have submitted Utils.java example to provide pure-java implementations and works without WifiManager. Code works also in Emulator.
By default, the Android emulator runs emulating a Ethernet connection, but not a wifi connection. Since the Wifi is not enabled, your code does not show a wifi mac address. See http://kmansoft.com/2010/07/27/debugging-wifi-in-the-emulator/
I found this answer very helpful when trying to view all the network devices and MacAddress on my device - https://stackoverflow.com/a/17719579/90236 to see