BluetoothLE1.ScanForService Doesn't Work

When I used BluetoothLE1.ScanForService, it did not show my device. Here is the picture of my blocks and the result:

When I disabled my BluetoothLE1.ScanForService block, it showed the device:

I also checked with nRF Connect, you can see the UUID is correct:

I use Android version 13 and BluetoothLE version 20230728.

Can someone see what the problem is?

Thank you!

Why are you calling both ScanForService and StartScanning? Call either one or the other. And are you including the service in the advertising packet for your device? What you're showing is the list of services queried after connecting to the device. The ScanForService block only captures those devices who include the service in the BLE advertisement packet (i.e., before connecting).

1 Like

Hi ewpatton,

Thank you for your answer. You are correct! I found it here How to use BLE scanforservice block? so I thought that was the correct way to use ScanForService.

Moreover, I checked my code again and yes, the service was not explicitly added to the advertising packet.

It works well now!

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