In my iOS App, which depends on a server backend, I want to offer the user a periodic check, whether the backend is available after the app failed to connect to the backend.
In most cases this should not be necessary, but in case there is a server problem my iOS shopping app can not proceed and right now just displays a view with very little information, which is available offline, and a button to "Try again" until the server is (hopefully very soon) available.
Now I would like to provide a better UX and make the button a "Notify me, when the shop is back online"
The idea is to check the shop server in periodic intervals and once it is back online to send a local notification to the user.
Now I might register for a background task, to download data in the background and inform the user about "new content", which might even not require a local notification.
That would be a UIBackgroundMode with a value of "fetch". But I have doubts, if that's a good approach. In 99.9% of the cases it will never happen and I also only need that background task, IF the server is not available AND IF the user taps on "Notify me". The docs however look like, this background fetch will ALWAYS run in the background. And that is not what I want.
How do other apps go about this problem? That should be a common task, isn't it?