skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. According to the Android Developer documentation, ScanMode.lowPower is the only possible mode for background scanning. You also need to request location access for the background (documentation here and here).

    Consider switching to Flutter Blue Plus instead of Flutter Blue; Flutter Blue Plus is the currently-maintained version. This pull request on GitHub shows that Flutter Blue cannot run in the background. The pull request has never been merged.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search