MAC ADDRESS

You can use the phone Wifi or Bluetooth MAC address as device identification, but not recommended, for two reasons:
hardware limitations: Not all devices have Wifi and Bluetooth hardware, the hardware does not exist naturally this information.
Limiting access: if Wifi is not opened, is unable to obtain its Mac address; while Bluetooth is only get to its Mac address when open.

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
public String getLocalMacAddress() {
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
WifiInfo info = wifi.getConnectionInfo(http://www.amjmh.com/v/BIBRGZ_558768/);
return info.getMacAddress();
}

 

Guess you like

Origin www.cnblogs.com/ly570/p/11667868.html