Advertisement
Guest User

Untitled

a guest
May 28th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. byte[] mac = NetworkInterface.getNetworkInterfaces().nextElement().getHardwareAddress();
  2.  
  3. String macAddress = "";
  4. for (int i = 0; i < mac.length; i++) {
  5. macAddress += String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : "");
  6. }
  7.  
  8. WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
  9. WifiInfo info = manager.getConnectionInfo();
  10. String macAddress = info.getMacAddress();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement