Android Lollipop BLE scan - receive peripherals without duplication

Android Lollipop has introduced a new way to scan BLE peripherals via BluetoothLeScanner .

From what I read, the new scan API solved the problem that happened with the old scan API ( BluetoothAdapter.startLeScan(UUID[],LeScanCallback)), where on some devices the callback ( onLeScan) was called only once to the periphery, even if the peripheral device continues to advertise.

This issue is handled on iOS using the CBCentralManagerScanOptionAllowDuplicatesKey option , which allows you to choose whether you want to detect only new peripherals or continue to receive advertisements from previously discovered peripherals.

Is there a similar option in the new Android Lollipop API? that is, decide that you want the callback to be called only for new peripherals (new MAC addresses) and not called twice for the same peripheral device.

I know that it could be easily implemented by saving the list \ set of all MAC addresses that were previously received, but this method does not take advantage of hardware optimization.

+4
source share

All Articles