Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created May 8, 2013 14:15
Show Gist options
  • Save mcatta/5540726 to your computer and use it in GitHub Desktop.
Save mcatta/5540726 to your computer and use it in GitHub Desktop.
Android getMacAddress
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
public static String getMacAddress(Activity activity) {
WifiManager wifiMan = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE);
WifiInfo wifiInf = wifiMan.getConnectionInfo();
return wifiInf.getMacAddress();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment