Search code examples
iosflutterdartbackgroundworkerrecurring

Running recurrency tasks in Flutter when application is in background


WorkManager allows us to run recurring background tasks, but not more often than 15 minutes.

I would like to run the background task in every minute.


Solution

  • I wrote the initial implementation of background execution support for Flutter plugins. The solution here depends on the platform you're specifically targeting (e.g., Android vs iOS). Both platforms have restrictions on how things can run in the background, with iOS being significantly more restrictive than Android.

    As far as I know, it's not possible to run a background task at regular fixed intervals on iOS, especially with a frequency of every minute, so this will also be a limitation for any Flutter plugin that you use for scheduling background work (see this post on limitations of background execution on iOS).

    Android also won't give you the ability to run a background task every minute unless you create a foreground service that uses a timer to trigger a task.