日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux mac地址文件夹,android4.4.2系统的mac地址文件在哪个文件里面

發布時間:2023/12/3 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux mac地址文件夹,android4.4.2系统的mac地址文件在哪个文件里面 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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;

}

取消

評論

總結

以上是生活随笔為你收集整理的linux mac地址文件夹,android4.4.2系统的mac地址文件在哪个文件里面的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。