Cannot find BLE devices using web bluetooth on Android Phone from a web app

Viewed 25

I have created a web application that is used to connect to the nearby BLE devices using web Bluetooth API on google chrome to read and write data. the web application is hosted on heroku and it is running as expected when accessed on PC (chrome version: 104.0.5112.102), i.e., the Bluetooth scanning and discovery is working perfectly. But when I try to access the web app using my android phone (OnePlus 7T with chrome version 105.0.5195.79), the pop window for BLE scanning is showing, but it does not discover any nearby BLE devices. Can someone help me out??

1 Answers

Are you scanning for beacons? iBeacon and Eddystone are filtered on Android 12+ because Chrome's manifest declares the BLUETOOTH_SCAN permission with neverForLocation.

If your app doesn't use Bluetooth scan results to derive physical location, you can make a strong assertion that your app never uses the Bluetooth permissions to derive physical location. To do so, complete the following steps:

  1. Add the android:usesPermissionFlags attribute to your BLUETOOTH_SCAN permission declaration, and set this attribute's value to neverForLocation.

Note: If you include neverForLocation in your android:usesPermissionFlags, some BLE beacons are filtered from the scan results.

https://developer.android.com/guide/topics/connectivity/bluetooth/permissions#assert-never-for-location

The relevant Chrome issue is https://crbug.com/1324831

Related