Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Bluetooth MAC Address via adb [duplicate]

Please help me to retrieve the Bluetooth MAC Address of my Galaxy S3 phone connected via USB port. My device is rooted.

like image 822
Antonio Avatar asked Aug 30 '12 13:08

Antonio


People also ask

Can you track a Bluetooth MAC address?

While iOS devices advertise Bluetooth continuity messages it's not possible to track iOS devices using their Bluetooth MAC address because the address changes over time in order to defeat such tracking. However, as previously mentioned, Bluetooth MAC randomisation can be defeated.

Can Bluetooth MAC address be changed?

They are so specific that they cannot be changed. MAC addresses can be used to identify devices on a network but they are not always visible to the general public.


4 Answers

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

like image 167
Ted Mielczarek Avatar answered Sep 21 '22 03:09

Ted Mielczarek


adb shell cat /sys/class/net/wlan0/address

like image 33
jinzhaoyu Avatar answered Sep 20 '22 03:09

jinzhaoyu


What I usually do to get the mac address of the WiFi interface of an Android device (that is connected to my PC through a USB port) is following these easy steps:

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"

The result will be looks like:

8e:5a:e7:c2:01:9b

In previous line, we used the -s option of the adb command to specify the serial number. Then we call the shell command to indicate that we will run a Linux command. Finally, we run the command: 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.

Note: If you run commands like cat /sys/class/net/wlan0/address you will get an error like cat: /sys/class/net/wlan0/address: Permission denied due to the security policies of Android.

like image 24
Teocci Avatar answered Sep 19 '22 03:09

Teocci


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)

like image 28
vtuhtan Avatar answered Sep 18 '22 03:09

vtuhtan