You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Background downloads on iOS and Android (URLSession background, foreground service), with pinned TLS #452
On iOS and Android, an app's net/http transfers stop when the app goes to the background: iOS suspends the process, and Android may stop it. Apps that download large files (Kando's phone app downloads films of several GB from the desktop) need the system's background transfer services: URLSession with a background configuration on iOS (the system keeps downloading and relaunches the app when done), and on Android a foreground service of type dataSync or WorkManager with setForeground, showing a notification with progress. Kando keeps the screen on while downloading as a workaround, which does not survive leaving the app.
Proposal
A download service: Download(cx, req, dest, opts) returning a handle with progress, pause/resume (Range), cancel, and completion delivered on the engine's goroutine, which continues in the background (iOS background URLSession, Android foreground service with a progress notification, the desktops in-process), survives the app being suspended, and reports downloads that finished while the app was not running when it starts again. Custom TLS trust (a pinned certificate) is needed for LAN servers with self-signed certificates.
Acceptance
On iOS and Android, a 2 GB download continues after the app is backgrounded and completes; progress resumes when the app comes back; a pinned self-signed server works.
Reviewed against the current platform architecture. This is a substantial cross-platform service, not a focused bug fix: iOS background URLSession requires delegate persistence and relaunch handoff, Android needs a foreground dataSync service or WorkManager plus notification permission and progress transport, and both need durable download state, range resume, cancellation, pinned TLS, and engine-goroutine delivery after relaunch. No existing core/driver service boundary covers this lifecycle. I am leaving the issue open for a dedicated download-service design rather than opening a partial API that cannot satisfy the acceptance criteria.
I audited #452 against the current platform contracts and extended the existing Android implementation to Apple and macOS in PR #1678.
The shared core.Scope.Download API now has durable task state, progress, pause/resume, cancellation, atomic publication and terminal replay. Android retains its foreground dataSync service. iOS uses grouped background URLSession sessions with launch reconnect, native resume data, journal recovery after container moves and exact certificate pin validation. macOS uses the same host with an in-process session. The public docs explain the Apple ATS requirement for self-signed endpoints.
Verification included Apple target checks, native publication and trust tests, a signed iPhone 2 GiB transfer that continued after the Go process exited and replayed after relaunch, and rejection tests that preserved prior destination files. Windows and Linux transfer hosts remain in the roadmap, so the issue stays open for those targets.
Activity
houko commentedon Nov 20, 2026
Reviewed against the current platform architecture. This is a substantial cross-platform service, not a focused bug fix: iOS background URLSession requires delegate persistence and relaunch handoff, Android needs a foreground
dataSyncservice or WorkManager plus notification permission and progress transport, and both need durable download state, range resume, cancellation, pinned TLS, and engine-goroutine delivery after relaunch. No existing core/driver service boundary covers this lifecycle. I am leaving the issue open for a dedicated download-service design rather than opening a partial API that cannot satisfy the acceptance criteria.houko commentedon Nov 22, 2026
I audited #452 against the current platform contracts and extended the existing Android implementation to Apple and macOS in PR #1678.
The shared
core.Scope.DownloadAPI now has durable task state, progress, pause/resume, cancellation, atomic publication and terminal replay. Android retains its foregrounddataSyncservice. iOS uses grouped backgroundURLSessionsessions with launch reconnect, native resume data, journal recovery after container moves and exact certificate pin validation. macOS uses the same host with an in-process session. The public docs explain the Apple ATS requirement for self-signed endpoints.Verification included Apple target checks, native publication and trust tests, a signed iPhone 2 GiB transfer that continued after the Go process exited and replayed after relaunch, and rejection tests that preserved prior destination files. Windows and Linux transfer hosts remain in the roadmap, so the issue stays open for those targets.