5

I'm building a Flutter app and need to call a function every day (to schedule some notifications). I came across the flutter_background_fetch package, which seems to be a perfect solution for Android, since the main limitation of the minimum 15 minute interval is not a problem.

However, I am supremely confused about how well the package works for iOS. According to the README, "When your app is terminated, iOS no longer fires events". However, I've also seen posts on Stackoverflow that claim that iOS Background App Refresh periodically relaunches your app to run background fetches (and posts that say it is unreliable or doesn't work at all).

So does flutter_background_fetch work on iOS when the app is terminated (eg. double tap home and swipe up)?

Edit: Also exploring flutter_workmanager, which seems promising.

nhjx
  • 51
  • 1
  • 4

1 Answers1

3

There is no perfect Dart solution for iOS to schedule background task as android when app terminate, in android we can use Alarm Manager

But you can try native side implementation with BGTaskScheduler

https://github.com/fluttercommunity/flutter_workmanager

harsha.kuruwita
  • 1,315
  • 12
  • 21
  • 1
    I was hoping not to go into Native code since that kinda defeats the point of a "single codebase" with Flutter...will keep in mind though! Also will check out workmanager. Thanks :) – nhjx Jul 15 '21 at 12:31