You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the foreground + fl_location package in my iOS app to keep my background process active.
It works perfectly, but only for a short period of time, around 20 minutes, the background stops triggering the onRepeat callback, only starting again after opening the app again.
I need the background service to run for a few hours with the app minimized and the screen off, just like it happens on Android.
Could you tell me if there's something wrong with my implementation?
My code snippet is basically very similar to the example project for the foreground location.
I'm using the following for testing:
Flutter 3.37,
iPhone SE 1st generation SDK 15.8.3
@ygorrrteles I wonder if this could be an iOS project configuration issue rather than a flutter_foreground_task repeat-event issue.
From what I understand, on iOS the Dart task will only continue running in the background if the app is being kept alive by one of Apple’s approved background modes. Since this example depends on FlLocation.getLocationStream(...), the iOS app needs to be properly configured for background location updates.
I need the background service to run for a few hours with the app minimized and the screen off, just like it happens on Android.
iOS behaves differently to Android, you need to make your application compatible with those rules and it's not responsability of flutter_foreground_task to handle that (and it's not even possible).
iPhone SE 1st generation: Background continues running for about 20 minutes after the app is minimized.
iPhone 11: The background works as expected, remaining running for several hours.
I did a test on the iPhone 11 with battery saver enabled, and it also had the background automatically terminated in approximately 20 minutes. Is this behavior standard on the iPhone SE, considering that this battery saver setting doesn't exist on this older phone?
Activity
ppamorim commentedon May 2, 2026
@ygorrrteles I wonder if this could be an iOS project configuration issue rather than a
flutter_foreground_taskrepeat-event issue.From what I understand, on iOS the Dart task will only continue running in the background if the app is being kept alive by one of Apple’s approved background modes. Since this example depends on
FlLocation.getLocationStream(...), the iOS app needs to be properly configured for background location updates.Could you confirm whether the iOS target has:
And
iOS behaves differently to Android, you need to make your application compatible with those rules and it's not responsability of
flutter_foreground_taskto handle that (and it's not even possible).ygorrrteles commentedon May 3, 2026
Yes, in my iOS project the keys are configured:
In my test, I also enable location always.
I'm testing with 2 iPhones.
iPhone SE 1st generation: Background continues running for about 20 minutes after the app is minimized.
iPhone 11: The background works as expected, remaining running for several hours.
I did a test on the iPhone 11 with battery saver enabled, and it also had the background automatically terminated in approximately 20 minutes. Is this behavior standard on the iPhone SE, considering that this battery saver setting doesn't exist on this older phone?
ppamorim commentedon May 3, 2026
For sanity check did you attempt to implement those services native and check the behavior?