看来java.net.NetworkInterface实施的Android不具备 byte []的getHardwareAddress()方法 http://developer.android.com/reference/java/net/NetworkInterface.html
人们试图用没有明确的答案做到这一点我发现几个论坛,我需要得到一个有点跨设备的UUID,所以我不能靠电话号码或ANDROID_ID(可重写,哪些我想取决于有一个谷歌帐户的用户) http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID
在linux下可以用ifconfig或从/ proc /净/ ARP读取,你可以很容易地获得硬件地址。
有没有在Android中的文件,我可以读?
必须有一种方式来获得这个地址,因为它显示在设置>关于手机>状态的电话。
解决方案必须有一种方式来获得这种 因为地址所在的显示在 设置>关于手机>状态的 手机上。
这意味着,如果不出意外,你可以去推杆围绕Android的开源$ C $ C,可能使用谷歌code搜索,找出它拉从。
做了一些闲逛自己的,这样看来它使用 getMacAddress()
从 WifiInfo
。
It seems the java.net.NetworkInterface implementation of android does not have a byte[] getHardwareAddress() method http://developer.android.com/reference/java/net/NetworkInterface.html
I've found several forums of people trying to do this with no definitive answer, I need to get a somewhat cross-device UUID, so I can't rely on phone numbers or in ANDROID_ID (which can be overwritten and which I think depends on the user having a google account) http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID
In linux you can use ifconfig or read from /proc/net/arp and you can easily get the Hardware address.
Is there a file in android that I can read?
There has to be a way to get this address since it's shown in the "Settings > About Phone > Status" of the phone.
解决方案There has to be a way to get this address since it's shown in the "Settings > About Phone > Status" of the phone.
Which means, if nothing else, you can go putter around the Android open source code, perhaps using Google Code Search, to figure out where it pulls that from.
Doing a bit of puttering myself, it would appear it is using getMacAddress()
from WifiInfo
.