Background Service To Fetch Data

Hi all. This is more of a discussion thread than a question about getting some code answers.

I am reading about background tasks and the Apple documentation example is not even complete and unusable. Just bits and pieces of code so a newbie like me doesnt find it helpful.

  1. What I am trying to do is run a background task even when the app is closed at 3 hour intervals. I have not seen any solution to this. is this possible?

  2. I figured trying to also look if it is possible to listen to when the user's internet connection is on or off because once it will be one, the service will run. if the internet is turned off, it disables the service (is this possible?)

I used this url as guide

https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/using_background_tasks_to_update_your_app#3193599

Note: I dont even know what RefreshAppContentsOperation is. At least they should have included the source for this. Or even if it's part of the sdk, at least include the import for this.