Open kkjk1176 opened 2 years ago
on Android, there is a WatchdogReceiver that executed by AlarmManager to ensure background service is running every 5 seconds.
on iOS there is no long running background service equivalent of Android. On iOS, the onBackground method will be executed by background fetch capability, that will be executed periodically every about 15 minutes once, and will be alive about 20-30 seconds.
on Android, there is a WatchdogReceiver that executed by AlarmManager to ensure background service is running every 5 seconds.
on iOS there is no long running background service equivalent of Android. On iOS, the onBackground method will be executed by background fetch capability, that will be executed periodically every about 15 minutes once, and will be alive about 20-30 seconds.
I know everything you said about ios. But what I'm talking about is two things.
on Android, there is a WatchdogReceiver that executed by AlarmManager to ensure background service is running every 5 seconds. on iOS there is no long running background service equivalent of Android. On iOS, the onBackground method will be executed by background fetch capability, that will be executed periodically every about 15 minutes once, and will be alive about 20-30 seconds.
I know everything you said about ios. But what I'm talking about is two things.
- Background fetch does not work when the app is placed directly in the background
- Periodically (15 minutes) background fetch does not work.
is it happened in example project too?
on Android, there is a WatchdogReceiver that executed by AlarmManager to ensure background service is running every 5 seconds. on iOS there is no long running background service equivalent of Android. On iOS, the onBackground method will be executed by background fetch capability, that will be executed periodically every about 15 minutes once, and will be alive about 20-30 seconds.
I know everything you said about ios. But what I'm talking about is two things.
- Background fetch does not work when the app is placed directly in the background
- Periodically (15 minutes) background fetch does not work.
is it happened in example project too?
yes the same problem occurs.
Also, in the example code, when backgroundFetch is executed manually in xcode, the backgroundFetch log is displayed, and the background service runs for only 1 second and ends.
Got it, the background service on iOS will be terminated immediately after the Future is completed, but it will be force terminated by OS if the Future takes more than 20 - 30 seconds.
I will investigate why the background fetch doesn't running in release mode when I have enough time. Thank you.
I have updated 2.4.1 to fix this, make sure the background fetch simulation is running from the xcode. In release mode, we can't expect the onBackground method executed exactly in every 15-20 minutes, because it's still up to the OS. See this explanation https://developer.apple.com/videos/play/wwdc2020/10063/
Here is the latest example project that showing background fetch log.
In release mode, we can't expect the onBackground method executed exactly in every 15-20 minutes, because it's still up to the OS
So it's mean, we can't know is background service running on release mode ?
I have this issue, displaying notif when debug mode. but after release mode app not displaying notification
After building in release mode in Xcode, I looked at the log. When the app is placed in the background by raising the indicator at the bottom, the background service does not work. When I manually click background import in xcode, the service works fine, but after waiting for 30 minutes the service doesn't work again. As far as I know, ios knows that the service should restart every 15 minutes.
In addition, in the case of Android, the following logs are continuously exposed.
D/BackgroundService( 8070): Service already running, using existing service
main.dart
doctor