Bluetooth LE ScanForService doesn't find SupportedServices

I am using the BluetoothLE module for an app in a school. There are lots of Bluetooth devices (phones in pockets, etc.), so I want to use ScanForService to find the right devices but that's not working. I can find and connect to a device using a generic scan, and when I connect to the device the SupportedServices list includes the ServiceUUID I am expecting.

This code is functionally nonsensical, but I put it together to demonstrate the issue:

After connecting to the device from a generic scan, I parse the SupportServices, disconnect, and then try scanning for one of the ServiceUUIDs. This does not find the device. However, this does work for an older generation of the device.

Why does ScanForService not find services that show up in the SupportedServices block?

The ServiceUUID you are searching for must be in the advertising packet. The services you see listed are likely discovered after connecting rather than being included in the device's advertising packet.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.