邯郸建设信息网站,无锡本地模板网站建设产品,seo优化团队,广西网站设计运营公司android 是Linux内核,linux中mac地址是保存在/etc/init.d/networ 文件中的但是在android中mac地址是直接写在硬件中的,需要通过API 才能获取1、Android 获取本机Mac 地址方法#xff1a;需要在AndroidManifest.xml文件中添加权限#xff1a;public String getLocalMacAddress…android 是Linux内核,linux中mac地址是保存在/etc/init.d/networ 文件中的但是在android中mac地址是直接写在硬件中的,需要通过API 才能获取1、Android 获取本机Mac 地址方法需要在AndroidManifest.xml文件中添加权限public String getLocalMacAddress() {WifiManager wifi (WifiManager) getSystemService(Context.WIFI_SERVICE);WifiInfo info wifi.getConnectionInfo();return info.getMacAddress();}2、Android 获取本机IP地址方法public String getLocalIpAddress() {try {for (Enumeration en NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {NetworkInterface intf en.nextElement();for (Enumeration enumIpAddr intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {InetAddress inetAddress enumIpAddr.nextElement();if (!inetAddress.isLoopbackAddress()) {return inetAddress.getHostAddress().toString();}}}} catch (SocketException ex) {Log.e(WifiPreference IpAddress, ex.toString());}return null;}取消评论