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 !

3
  • have you found any solution?
    – abh22ishek
    Jun 20, 2016 at 14:18
  • If i remember correctly i wasn't calling 'stopLeScan()' correctly. After adding stopLeScan my device was detected correctly.
    – Azartys
    Jun 20, 2016 at 15:39
  • it's happening with me same thing
    – abh22ishek
    Jun 20, 2016 at 17:47

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.