John O'Reilly
03/25/2025, 5:39 PMDaniel Seither
03/25/2025, 5:50 PMJohn O'Reilly
03/25/2025, 6:17 PMDaniel Seither
03/25/2025, 7:29 PMJohn O'Reilly
03/25/2025, 9:31 PMPearce Keesling
03/27/2025, 10:57 PMF
03/28/2025, 12:28 AMJohn O'Reilly
03/28/2025, 7:20 AMJohn O'Reilly
03/28/2025, 10:28 AMBGTaskScheduler
under the hoodJohn O'Reilly
03/28/2025, 10:57 AMcurioustechizen
03/28/2025, 1:31 PMWorkManager
, I can create a worker and schedule it such that
• The sync happens immediately if there is network connectivity
• If the sync starts and the app enters the background, the sync operation continues
• If there is no network connectivity right now, and the user continues using my app, when network connectivity is restored, the sync operation runs (even if my app is still in the foreground)
• If there is no network connectivity right now and the my app enters the background, sometime later when network connectivity is restored, the sync operation runs (even if my app is in the background or the device is restarted).John O'Reilly
03/28/2025, 1:32 PMcurioustechizen
03/28/2025, 1:38 PMbeginBackgroundTask
or some combination of NSURLSession or whatever.
• Only the last bullet point can be achieved with BGTaskScheduler
So you need to use a combination of several approaches to achieve the same goal.John O'Reilly
03/28/2025, 1:42 PMbeginBackgroundTask
) .....if in background then schedule background task (but no guarantees as to when that will run!)curioustechizen
03/28/2025, 1:50 PMMatthew Ramotar
03/28/2025, 11:16 PMMatthew Ramotar
03/28/2025, 11:18 PMJohn O'Reilly
03/29/2025, 12:14 PM