androidbluetoothbluetooth-lowenergyweb-bluetooth

Advertising Bluetooth MAC address of phone through webpage


I'm fairly new to web Bluetooth and am trying find a way to advertise the unique bluetooth MAC address of an android phone using web Bluetooth (I am trying to read the bluetooth MAC address using a Raspberry Pi Zero W).

I have tried the web demo at https://webbluetoothcg.github.io/demos/bluetooth-printer/ - running on an android phone and reading using the Zero W. But the MAC address read by the RPi Zero W changes each time I press "Pair" on the webpage.

I saw this post about IOS (Randomize Mac Address in BLE), so I'm guessing android also randomizes the (BLE) MAC address.

Is it possible to advertise the phones unique MAC address - or anything else that can uniquely identify the phone - through web Bluetooth on an android phone? (Preferably through BLE for speed). If yes, how can that be done?

Also would this work in a similar way on IOS?

Thank you


Solution

  • The Web Bluetooth API currently allows websites, running in the Central role, to connect to remote GATT Servers over a BLE connection. In other words, this API discovers and communicates with devices over Bluetooth using the Generic Attribute Profile (GATT).

    What you're looking for is an API that lets you simulate BLE peripherals. You may want to try the BLE Peripheral Simulator android app that is used as a companion to the Web Bluetooth API to ease experiments by providing another device to connect to.

    Or you can use nRF Connect for Mobile Android app, a powerful generic tool that allows you to scan, advertise and explore your Bluetooth Low Energy (BLE) devices and communicate with them.