如何获取WiFi网络接口的MAC地址? [英] How to obtain MAC address of WiFi network interface?

查看:525
本文介绍了如何获取WiFi网络接口的MAC地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来java.net.NetworkInterface实施的Andr​​oid不具备
byte []的getHardwareAddress()方法 <一href="http://developer.android.com/reference/java/net/NetworkInterface.html">http://developer.android.com/reference/java/net/NetworkInterface.html

人们试图用没有明确的答案做到这一点

我发现几个论坛,我需要得到一个有点跨设备的UUID,所以我不能靠电话号码或ANDROID_ID(可重写,哪些我想取决于有一个谷歌帐户的用户) <一href="http://developer.android.com/reference/android/provider/Settings.Secure.html#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.

这篇关于如何获取WiFi网络接口的MAC地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆