Android:设备唯一识别码

// 在wifi未开启状态下,仍然可以获取MAC地址,但是IP地址必须在已连接状态下否则为0
String macAddress = null, ip = null;
WifiManager wifiMgr = (WifiManager)getSystemService(Context.WIFI_SERVICE);
WifiInfo info = (null == wifiMgr ? null : wifiMgr.getConnectionInfo());
if (null != info) {
    macAddress = info.getMacAddress();
    ip = int2ip(info.getIpAddress());
}
System.out.println("mac:" + macAddress + ",ip:" + ip);

 

你可能感兴趣的:(Android:设备唯一识别码)