Is it possible to change Bluetooth device's name?
nex314 opened this issue · 4 comments
As title,
I want an unique to record which Bluetooth device was connected .
Is it possible to change Bluetooth device's name?(I want to set a unique name)
Have any API can do this?
Or have any API can get connected Bluetooth device's MAC address?
thanks.
Getting the Bluetooth address is not possible for security/privacy reasons.
If the device supports writing the standard Device Name characteristic, then you can use that to change the name.
While the real Bluetooth address is not available for privacy reasons the Web Bluetooth API provides an id
attribute which is an anonymized version of the address. In the default configuration Chromium-based browsers generate a new ID for every browsing session however if you enable about://flags/#enable-web-bluetooth-new-permissions-backend
then the ID will be consistent between sessions. This new configuration is still being tested but should be shipped eventually.
As noted above, changing the device's advertised name is only possible if allowed by the device firmware.
Thanks for yours kindly reply.
Is it possible that the different computers generate a same ID when connect the same Bluetooth device?
No, different computers will always generate different IDs for the same device.