Periodic background tasks in IOS device

1,563 views
Skip to first unread message

Ebuy-Musie Gebrezgabher

unread,
Oct 21, 2021, 8:59:00 AM10/21/21
to Flutter Development (flutter-dev)
Hi Flutter community, 

I have implemented a periodic background tasks(using the WorkManger plugin) which should run daily (or nearly daily) using flutter for an IOS device.
I have tested the background task in Android device and they work correctly. But in IOS they are not running even close to the frequency they are supposed to. In the flutter documentation I see that, in IOS, the WorkManger for background tasks still does not support implementation of periodic tasks. 
Do you know any alternative solution(or possible workaround) for this issue? or do you think Flutter will make this this feature available soon?

thank you,
Musie Ebuy

BabsKy

unread,
Oct 22, 2021, 12:15:55 PM10/22/21
to Flutter Development (flutter-dev)
Hi, 
According to the WorkManager documentation, periodic tasks are for Android only.

Customisation (Android only!) 

Not every Android WorkManager feature is ported.

Two kinds of background tasks can be registered :

  • One off task : runs only once
  • Periodic tasks : runs indefinitely on a regular basis
In the Enable BGTaskScheduler section of iOS setup:
Schedule a processing task request to ask that the system launch your app when conditions are favorable for battery life to handle deferrable, longer-running processing, such as syncing, database maintenance, or similar tasks. The system will attempt to fulfill this request to the best of its ability within the next two days as long as the user has used your app within the past week.

I was put off using WorkManager, if I remember right because it doesn't work if the app is killed, so I'm using background_fetch instead.
There are still limitations but they are limitations placed by Apple: your app has to be used regularly for the background fetch to work, no matter which plugin you use. 
If there is a better solution I would also like to know, my app relies on a reliable background task.

BabsKy

unread,
Oct 22, 2021, 12:21:57 PM10/22/21
to Flutter Development (flutter-dev)
Sorry, I missed "I see that, in IOS, the WorkManger for background tasks still does not support implementation of periodic tasks."  but hopefully the rest is helpful. 
Reply all
Reply to author
Forward
0 new messages