fluttercommunity / flutter_workmanager

A Flutter plugin which allows you to execute code in the background on Android and iOS.
851 stars 260 forks source link

[iOS] Periodic tasks support #433

Closed wryczko closed 1 year ago

wryczko commented 1 year ago

Hi,

Are you planning to implement/support periodic background tasks for iOS?

Possible duplicate: https://github.com/fluttercommunity/flutter_workmanager/issues/306

Regards

xunreal75 commented 1 year ago

Timer related scheduled periodically background updates are not supported by iOS . You can't ensure time of execution . See Apple documents .

It’s unlikely that the system will ever decide to run your task and, even if it does, that commitment will fade away over time.

I think you need another solution.

At the Moment work manager doesn't run in background on IOS release see #402

wryczko commented 1 year ago

thanks @xunreal75 for a reply. I need to implement a solution that would run some function in background once every day (can be every other day too). I don't care when exactly. Do you happen to have any suggestions? I was thinking about silent push notifications as an alternative.

xunreal75 commented 1 year ago

Sorry at the moment I didn't found any working solution. I'm looking forward to track the issue during next week. perhaps I can find the wrong piece of code and contribute work manager for IOS device.

The other alternative background_fetch seems to have similar problems. Perhaps it's a flutter issue.

ened commented 1 year ago

iOS behavior for background processes won't get you the "fine-grained" APIs to truly run periodic background tasks. The closest I can think of is to have a server send you a periodic data push request to wake the App up. This will may also be cancelled by the system.

Consider the use case whether you truly need periodic App wakeup, based on time.