This question already has an answer here:
Please help me to retrieve the Bluetooth MAC Address of my Galaxy S3 phone connected via USB port. My device is rooted.
Running netcfg
will show you all interfaces on the system along with their MAC addresses.
adb shell cat /sys/class/net/wlan0/address
I usually get the mac address of the WiFi interface of an Android device (that is connected to my PC through a USB port) by running these commands:
Find the device name using:
adb devices
Results usually looks like:
List of devices attached 4e7354af device 1f97033e device
In this case we have two devices connected
4e7354af
and1f97033e
. Let's work on the first one:4e7354af
Get the mac address for the first device:
adb -s 4e7354af shell ip addr show wlan0 | grep 'link/ether '| cut -d' ' -f6
In previous line, we used the
-s
option with theadb
commands to specify the serial number. Thenshell
indicate that is a linux command followed by theip addr show wlan0 | grep 'link/ether '| cut -d' ' -f6
this command can also be used in Linux if its interface has the same name aswlan0
.
I generally use this approach because I have many devices connected to my testing environment. Good luck guys.
Isn't bluetooth MAC address available on every Android phone in Settings?
Currently I have 2 devices near:
On Samsung Galaxy S2 - Settings > About Phone > Status
On HTC Desire - Settings > About Phone > Hardware Information
(Bluetooth must be turned on)
来源:https://stackoverflow.com/questions/12197925/get-bluetooth-mac-address-via-adb