I'm having this onScanFailed
error code on some devices (LG to be more detailed) when discovering BLE devices on android. The code works as expected on another devices. How can i fix it?
I use BLE API 21+ and the following code to discover:
ScanSettings scanSettings = new ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.setReportDelay(discoveryDelay)
.build();
Here are the full sources: https://github.com/4ntoine/protobuf-ble-rpc/blob/hi-p/android/client/src/main/java/com/googlecode/protobuf/blerpc/BleRpcConnectionFactory.java#L362
Some devices do not support all of the features of the new LE API. The features are hardware specific and up to the manufacturer to enable. The best approach is to check for the supported feature before building the filter and settings.
bluetoothAdapter.isOffloadedFilteringSupported();
bluetoothAdapter.isOffloadedScanBatchingSupported();
I haven't found any issues with issuing filters when OffloadedFiltering
isn't supported.
If OffloadedScanBatching
isn't supported, then you should not set a report delay. Attempting to set a report delay of anything other than 0
will result in an error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With