I am using Web Bluetooth to connect to a device and read the name and battery level. I got it working but the device I want to connect with is "Unknown or unsupported" but I have no idea why. On requestDevice() I only get my Iphone and a lot of unknown devices.
When I check the bluetooth devices on chrome://bluetooth-internals
I see a few known devices but not the one I am looking for. I have to guess the right device based on the latest RSSI. This is not user friendly.
Is there a way to fix this? Or can someone explain why almost all the devices are unknown or unsupported.
I am using a Mac. (Incase this matters)
UPDATE @François Beaufort
A screenshot of the nRF Connect app. In the app the device has a name. I just saw that the device had a name in bluetooth-internals
too, but it seems like it doesn't advertise its name always.
And it says Device type: Google
but it isn't a device from Google.
The name you're seeing in the bluetooth browser chooser is the human-readable name of the bluetooth device. A bluetooth device may have two different name types: one that the bluetooth device advertises and another that the bluetooth device publishes in its database as its Bluetooth low energy Generic Access Profile (GAP) device name. If a bluetooth device has both types of names, you'll get the GAP device name.
If you're seeing "Unknown or Unsupported Device (12:34:56:78:9A:BC)"
, it means the bluetooth device didn't advertise its name. In order to reduce the noise in the bluetooth chooser, I'd recommend using other filters such as "services"
if you notice your bluetooth device advertises some. See full developer documentation at https://web.dev/bluetooth/#services-filter
navigator.bluetooth.requestDevice({ filters: [{ services: ['battery_service'] }] })
.then(device => { /* … */ })
.catch(error => { console.error(error); });
Update: You can see advertised services at chrome://bluetooth-internals/#devices
in the "Services" column in Chrome 93. See https://chromiumdash.appspot.com/commit/49610d372d4d479f43e918d7bbf14537efd2769c