I have a Bluetooth Low Energy (BLE) device and want to access it from a web page using the Web Bluetooth API.
This works perfectly fine in Chrome on Windows (at least with current versions of Chrome and Windows) and even with the WebBLE App on iPadOS (since Safari won't support WebBluetooth).
But I have multiple Android devices running the current versions of Android (12) and Chrome (97), where in the browser device chooser, the device won't show up. Some other unknown devices show up, but my device does not.
What could be the reason just this one device does not show up and how could I gather more information about this situation? It happens in the native browser dialog so my usual debugging steps don't work.
Update:
I have already checked with chrome://bluetooth-internals
, and the result is the same. The device shows up on Chrome/Windows but not on Chrome/Android.
Now I also used chrome://device-log
which on both Windows and Android shows only
Bluetooth Internals Page initiating Bluetooth discovery session
nRF Connect for Mobile shows the device instantly, and it also shows up in the Android Bluetooth settings. Only Chrome Web Bluetooth doesn't show it.
Update2:
The adb logcat
reveals the following line during Chrome Bluetooth discovery:
V/BtGatt.GattService(19403): Skipping data matching denylist
What's that? Has Chrome its own denylist for bluetooth devices?
CodePudding user response:
https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs/ lists tools and log viewing approaches thay may help, including:
chrome://bluetooth-internals
- nRF Connect for Android
chrome://device-log
Try requestDevice with "acceptAllDevices":true as well if you haven't yet.
CodePudding user response:
The reason the device is not showing up is that Android has a denylist which matches Eddystone and iBeacon payloads using the advertising data.
My device seems to have something in its advertising data which matches Eddystone or iBeacon and thus is ignored, even though it is a digital tape measure.
Sources: https://android.googlesource.com/platform/packages/apps/Bluetooth/ /master/src/com/android/bluetooth/gatt/GattService.java#255 https://android.googlesource.com/platform/packages/apps/Bluetooth/ /master/src/com/android/bluetooth/btservice/AdapterService.java#3939