I have developed two applications and they are both using a background agent. When I turned on Airplane Mode last night, and woke up tomorrow I saw (Settings > Background Tasks) that 1 Background Task was running fine, and the other was not.
The one that was disabled gets data from a Weather API, and the other just generates random tiles (no internet connection).
When I opened the app, and went back to the Background Tasks it enabled itself.
What is going on here? I know that a background task will disable itself when the app is not used for 14(?) days, but this is not the case. And of course I know that the background task won’t run when the phone is in Airplane Mode.
So, how can I enable my app to turn itself on again when the Airplane Mode is turned off? Just like my other (offline) app does.
Kind regards,
Niels
It probably means that your background task doesn’t handle graciously no-connectivity errors. When your background agent fails two times in a row, it’s automatically disabled by the OS.
Just put your network call in a try/catch block to solve the issue.