0

We need to track location of the device and need to run it periodically (we need to get updates, even when the device is not moving).

For this purpose we are using background fetch with this config

BackgroundFetchConfig(
minimumFetchInterval: 15,
requiresBatteryNotLow: false,
requiresCharging: false,
requiresStorageNotLow: false,
requiresDeviceIdle: false,
requiredNetworkType: NetworkType.NONE,
),

And it's working when the screen is on or the device is charging (tasks runs every 15-30 minutes), but the moment you unplug the phone - tasks stop from firing.

We need it to run every 15-30 minutes even when the device is unplugged (at least with high battery level)

The device is not in power saving mode.

What are we doing wrong?

  • Background fetch does not guarantee anything close to 15 to 30 minutes. It's based upon the pattern of the user’s app usage history, and at the sole discretion of the OS. If you want to be notified when the user moves, I would consider the “significant change” location service. – Rob Jul 18 '23 at 15:57
  • "We need it to run every 15-30 minutes even when the device is unplugged". A question like this comes up almost every day. The short answer is, on iOS, there is absolutely no way of doing anything remotely like that. iOS just does not have any sort of deterministic scheduling capabilities – Gruntcakes Jul 18 '23 at 18:22
  • Also, which plug-in are you using for flutter for background processing? At least one popular plug-in creates `BGProcessingTasks` instead of `BGRefreshTasks`. But, as the others have said, this is the wrong approach. – Paulw11 Jul 18 '23 at 20:50

0 Answers0