Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Periodic Background Tasks in Flutter IOS

I want to execute some background task in Flutter when the app is not in opened state. It is either in background or in terminated state. The requirement is that i want to fetch the device location after regular intervals say 15 minutes and send it to server. After researching quite a lot, I found workmanager package for flutter for the same purpose. It works for Android (not perfectly because of some battery restrictions) but it does not work for iOS. Periodic tasks are not handled for iOS in this package and only One Off task works. However this package was quite close to my requirement while others cant. I have tried a lot available packages. So I am left with two options:

  1. Either provide the package for the same requirement. (I have tried almost all of them)
  2. Another way is to write some native IOS in Swift and inject it into my flutter using method channel. I haven't worked with iOS. So I want full working code for the same. If someone does not know Flutter, then provide me the working native ios code in swift.
like image 357
Adnan Avatar asked Dec 22 '25 02:12

Adnan


1 Answers

There is two ways

  • backgorund tasks (not very efficient) https://developer.apple.com/documentation/backgroundtasks

  • silent pushes, client needs to have pushes notifications activated. But, you can manage update intervals with your backend like you want

like image 78
Igoretto Avatar answered Dec 24 '25 16:12

Igoretto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!