capacitor-community / bluetooth-le

Capacitor plugin for Bluetooth Low Energy
MIT License
285 stars 85 forks source link

Can’t find any android device #603

Closed Rossella-Mascia-Neosyn closed 11 months ago

Rossella-Mascia-Neosyn commented 11 months ago

Describe the bug With this ZTE Blade A51 Android 11 device, API 30 cannot find any device

To Reproduce Steps to reproduce the behavior:

  1. Start scan
  2. Wait list device
const  scan = async (): Promise<void> => {
    try {
      await BleClient.initialize();
      const isEnable = await checkBluetoothStatus();
      if (isEnable) {
        const device = await BleClient.requestDevice({
          scanMode: ScanMode.SCAN_MODE_LOW_POWER,
          namePrefix: 'TEST',
        });
        await connectBt(true, device);
        await BleClient.stopLEScan();
        console.info('stopped scanning');
      }
    } catch (error) {
      console.error(error);
    }
  };

Expected behavior find a device when I start the scan

Screenshots With logcat i found this error BluetoothLeScanner: could not find callback wrapper image

Plugin version:

Smartphone (please complete the following information):

Additional context I also tried to recover scanMode and namePrefix but can’t find any device

pwespi commented 11 months ago

Are location services enabled? This can be checked with the isLocationEnabled method.

Rossella-Mascia-Neosyn commented 11 months ago

Enabling geocalization worked but sometimes still not find anything

Screenshot 2023-12-06 at 15 17 32