PhilipsHue / flutter_reactive_ble

Flutter library that handles BLE operations for multiple devices.
https://developers.meethue.com/
Other
667 stars 331 forks source link

Enable changing CBCentralManagerScanOptionAllowDuplicatesKey for better battery life #627

Open seanhamstra opened 1 year ago

seanhamstra commented 1 year ago

Is your feature request related to a problem? (please describe) On iOS CBCentralManagerScanOptionAllowDuplicatesKey value when scanning devices should be exposed. This can save on battery life in applications where scanning takes place over long periods of time. Right now it is hardcoded to true.

Describe the solution you'd like A bool should be exposed for allowDuplicates on the scanForDevices library method. On the native side the method in Central.swift should be updated to be dynamic:


        isScanning = true
        centralManager.scanForPeripherals(
            withServices: services,
            options: [CBCentralManagerScanOptionAllowDuplicatesKey: allowDuplicates]
        )
    }
Taym95 commented 1 year ago

Hi, thank you for reporting this issue, can you contribute and add this flag? I will be happy to review it, else we may add it when we got some time!