1

The sensors of are also bluetooth beacons with a custom (128 bit) serviceUUID. This serviceUUID is sent as part of the scanResponse, not the advertisementData.

Doing a BLE scan with filtering by serviceUUID and reading serviceUUIDs from the scanRecord worked fine, until we had to increase the targetSdkVersion to 31 (required for upload to google).

Trying a scan with filter by serviceUUID yields no results at all.

Doing a scan without filter finds the sensors (and other BLE devices), but the serviceUUID list is empty. So no chance for filtering in the application code.

AFAICT getting the scanResponse requires an extra request (but no connect) to the BLE device. It seems this was done automatically until targetSdkVersion 30 (and still no problems on iOS).

Looking at the api docs, I haven't seen any parameter/flag/... to trigger getting the scanResponse again.

Anybody an idea what changed and how to get the complete ScanRecord again?

Ray
  • 31
  • 5
  • To recieve scan results in API 31 and above you have to handle the `BLUETOOTH_SCAN` permission. And also `BLUETOOTH_CONNECT` for connection related API usages. See my answer [here](https://stackoverflow.com/a/72842249/12749998) where I show how to handle bluetooth permissions for all API levels. – Kozmotronik Dec 07 '22 at 13:37
  • Thank you, but adjusting the permissions for the new targetSdkVersion is already done and not the problem. Getting the serviceUUIDs or filtering by them is, since they're sent in the scanResponse, not the advertisementData. – Ray Dec 07 '22 at 15:25

0 Answers0