4

I'm working on an Android app that needs to connect to a Bluetooth Low Energy device.

The app is working correctly on most devices but i had troubles with some devices (One plus One with Cyanogene Android 4.4.4 and Sony C5303 with Android 4.3) using BluetoothAdapter.startLeScan().

With the One plus, the problem seems to be the same as related in this post: Android 4.3: BLE: Filtering behaviour of startLeScan() the Bluetooth device is only scanned once. If I connect then disconnect from the device, it is not scan it again.

After some test I tried using: BluetoothAdapter.startDiscovery() in addition to BluetoothAdapter.startLeScan().

It appears that my device is now correctly scanned multiple times and my LeScanCallback is correctly called. I can then connect/disconnect from my BLE device.

Question is: How BluetoothAdapter.startDiscovery() can interact with BluetoothAdapter.startLeScan() to allow my device being detected multiple times ?

Thanks for you help !

Community
  • 1
  • 1
Azartys
  • 393
  • 5
  • 13

1 Answers1

1

You should calling 'stopLeScan()' correctly. After adding stopLeScan your device should be detected correctly.

Baguetto
  • 21
  • 3