Get Bluetooth MAC Address via adb [duplicate]

梦想的初衷 提交于 2019-11-30 08:41:54

Running netcfg will show you all interfaces on the system along with their MAC addresses.

jinzhaoyu

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:

  1. 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 and 1f97033e. Let's work on the first one: 4e7354af

  2. 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 the adb commands to specify the serial number. Then shell indicate that is a linux command followed by the ip addr show wlan0 | grep 'link/ether '| cut -d' ' -f6 this command can also be used in Linux if its interface has the same name as wlan0.

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!