Hello everyone, I'm developing a new feature that allows the user to keep track of a background upload through live activities.
Im using the URLSessionTaskDelegate
to keep track of the task progress and it works fine when the app is in foreground, but when the app goes to background, it stop after a few seconds. The upload still continues and Im able to receive updates on it's completion through the application(_ application: UIApplication, handleEventsForBackgroundURLSession
but only through that.
Also when I put the app back to foreground it updates to the correct progress so this is only happening in background.
This is the URLSessionConfiguration
I'm using:
let config = URLSessionConfiguration.background(withIdentifier: "\(uploadBackgroundTaskIdentifier)")
config.isDiscretionary = false
config.allowsCellularAccess = true
config.shouldUseExtendedBackgroundIdleMode = true
config.sessionSendsLaunchEvents = true
config.timeoutIntervalForResource = 28800
Does anyone knows how should I be able to keep track of the progress even when the app is in background?