Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the address of my BluetoothDevice changes every time I relaunch the app?

I'm doing some simple scanning + advertising testing on bluetooth LE feature for Android using this sample-code

I'm testing it using a Samsung 6 and a Nexus 9, and for some reason if I leave the app running on the Samsung and restart the app on the Nexus, the next time the Samsung devices finds the other device, it has a different address.

In code:

enter image description here

On the device:

enter image description here

The funny thing it doesn't happen the other way around. (Samsung always has the same address when discovered from the Nexus 9)

  • Is this a common behavior between devices?
  • Is there another way to identify a specific device besides it's mac address?
like image 277
Omer Avatar asked Mar 23 '16 14:03

Omer


People also ask

Do Bluetooth addresses change?

This address never changes and is guaranteed to be unique for a Bluetooth device. However, there is a fee associated with obtaining/reserving a block with the IEEE. The following diagram represents the simplified format of a Public Bluetooth Address.

Can someone connect to my Bluetooth without me knowing?

Can someone connect to my Bluetooth without me knowing? Theoretically, anyone can connect to your Bluetooth and gain unauthorized access to your device if the visibility of your Bluetooth device is on.

How do you make a Bluetooth device connect automatically?

How Do I Make My Android Phone Automatically Connect To Bluetooth? enable Bluetooth automatically by selecting Settings > Connected devices > Connection preferences > Driving mode > Turn on automatically > Advanced. For your convenience, you can find out whether this switch is enabled.

How do I change the Bluetooth address on my Android phone?

How Do I Change My Bluetooth Device Id? The Bluetooth settings will tell you what device name you are using.In some cases, changing the name will be done simply by tapping it. Other times, however, you'll need to open the three-dot menu in order to do so.To rename a device, enter its name, then tap “Rename.”.


1 Answers

As CommonsWare mentioned, as of Android 6.0, Android has removed access to the hardware address programmatically, and made it so that the address appears to be randomly generated to scanning devices. The change log can be found here:

http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-hardware-id

The fact that scanning devices see a random Bluetooth address rather than the actual one is a highly useful privacy feature. It was adopted by the Bluetooth specification as of BTv4.0 and is known as LE privacy:

"This feature causes the MAC address within the advertising packets to be replaced with a random value that changes at timing intervals determined by the manufacturer. Any malicious device(s), placed at intervals along your travel route, would not be able to determine that the series of different, randomly generated MAC addresses received from your device actually relates to the same physical device. It actually looks like a series of different devices, thus, it will not be possible to track you using the advertised MAC address"[1]

You can find a similar question here:-

Since marshmallow update Bluetooth discovery using BluetoothAdapter.getDefaultAdapter().startDiscovery(); is broken

[1] http://blog.bluetooth.com/bluetooth-technology-protecting-your-privacy/

like image 144
Youssif Saeed Avatar answered Oct 05 '22 07:10

Youssif Saeed