xinthink / flt_worker

Schedule & run Dart code in the background on both Android & iOS
MIT License
28 stars 8 forks source link

What should I do for iOS < 13? #1

Closed julien-h2 closed 4 years ago

julien-h2 commented 4 years ago

Hello,

Thank you for the amazing plugin! I'm thinking about using it in my app to upload data to a server. There is a "background upload" plugin but I need to use client SSL certificates that this other plugin can't handle so a combination of your plugin and dio might save me.

I still want to be able to install my app on iOS < 13, in which case it's fine if the upload doesn't happen in a background task.

Is there a way to do this with you plugin? Or maybe just disable it for platforms < 13?

Thanks for the help! I'm still new to flutter, sorry if that's a dumb question

xinthink commented 4 years ago

Sorry for replying so late. As I know, there's no way to run a long-running or periodic background task on devices with iOS versions below 13.0. What we can do is try the best to finish the task before the app is killed by the OS, after it's switched into the background. The duration will be several minutes, which is long enough for most of the tasks. So you may consider uploading data in the applicationDidEnterBackground callback, on iOS devices below 13.0. And you may have to run the interrupted task again if it's terminated by the system before it's done.

julien-h2 commented 4 years ago

Thanks Yingxin