Search code examples
androidflutterbluetoothbackgroundwifi

Can not run Wifi and Bluetooth scans in background with Flutter


I am working on a part of an indoor localization project. I need my Flutter application scan and get Mac addresses and RSSI values of Wifi and Bluetooth devices. I am using flutter_blue for bluetooth scans and wifi_scan for Wifi scans. The application works well while in the foreground but scans are failing when the application is in background.

What I have tried so far:

Is there any way to achieve this? Aren't there any package with the option backgroundMode: true? I don't know the natives. Don't know Kotlin too.


Solution

  • After a lot of things have been tried, I just tried to get GPS location too.

    Used this package: location

    And execute location.enableBackgroundMode(enable: true) as it is stated in readme, then my wifi and bluetooth scans starts working in background too.

    It's Ridicoulus