获取android以太网MAC地址(不是wifi接口) [英] Get android Ethernet MAC Address (not wifi interface)
本文介绍了获取android以太网MAC地址(不是wifi接口)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是Api级别8的Android,我想获取我的以太网接口的地址(eth0).
I'm using Android with Api level 8 and I want to get the Address of my Ethernet interface (eth0).
在API级别8上,NetworkInterface类没有函数getHardwareAddress(). WifiManager也不起作用,因为它不是无线接口.
On API level 8, the NetworkInterface class don't have the function getHardwareAddress(). The WifiManager also does not work since this is not an Wireless interface.
提前谢谢!
推荐答案
假设您的以太网接口是eth0,请尝试打开并读取文件/sys/class/net/eth0/address
.
Assuming your ethernet interface is eth0, try opening and reading the file /sys/class/net/eth0/address
.
这篇关于获取android以太网MAC地址(不是wifi接口)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文