react-native-ble-manager icon indicating copy to clipboard operation
react-native-ble-manager copied to clipboard

Sometimes the scan doesn't find all devices

Open GioMaugeri opened this issue 1 year ago • 1 comments

Describe the bug I try the scan and sometimes the scan find all the devices, sometimes not. The devices that sometimes I don't found aren't paired and are available because I can see if I do a bluetooth scan with another app (nRF connect). The bluetooth devices are always near to my smartphone when I test.

I use this code:

const SECONDS_TO_SCAN_FOR = 20;
const SERVICE_UUIDS: string[] = [];
const ALLOW_DUPLICATES = true;

BleManager.scan(SERVICE_UUIDS, SECONDS_TO_SCAN_FOR, ALLOW_DUPLICATES, {
          exactAdvertisingName: 'Blux',
        })

I don't know if I have to add other options to scan method.

Expected behavior The scan find alway all the devices.

Smartphone (please complete the following information):

  • Device: Xiaomi Mi A3, Motorola G84
  • OS: Android 11, Android 13
  • react-native-ble-manager version: 11.1.0
  • react-native version: 0.73.2

GioMaugeri avatar Mar 29 '24 08:03 GioMaugeri

Describe the bug I try the scan and sometimes the scan find all the devices, sometimes not. The devices that sometimes I don't found aren't paired and are available because I can see if I do a bluetooth scan with another app (nRF connect). The bluetooth devices are always near to my smartphone when I test.

I use this code:

const SECONDS_TO_SCAN_FOR = 20;
const SERVICE_UUIDS: string[] = [];
const ALLOW_DUPLICATES = true;

BleManager.scan(SERVICE_UUIDS, SECONDS_TO_SCAN_FOR, ALLOW_DUPLICATES, {
          exactAdvertisingName: 'Blux',
        })

I don't know if I have to add other options to scan method.

Expected behavior The scan find alway all the devices.

Smartphone (please complete the following information):

  • Device: Xiaomi Mi A3, Motorola G84
  • OS: Android 11, Android 13
  • react-native-ble-manager version: 11.1.0
  • react-native version: 0.73.2

Try messing with the scanOptions on .scan method. It has a couple of cool options in there that can speed up scan, change latency of scan and even change the behavior of the type of scan. Actually the scan options are paired exactly with the options available on the Android docs. Take a look on that

lucaswitch avatar Jun 16 '24 23:06 lucaswitch

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

marcosinigaglia avatar Sep 15 '24 02:09 marcosinigaglia