Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created May 8, 2013 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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