[Bug]: Keep automatic channel and playlist downloads running in the background
Which app?
MeeTube (phone or tablet)
What would you like MeeTube to do?
Please make the existing channel/playlist Auto download flow reliably discover and finish downloads when MeeTube is in the background or its UI has been closed.
The app's interface should not need to remain open for a queued background download to finish. In my use, automatic downloads are not reliably picked up or completed once I leave MeeTube.
Expected behavior
- Selected channels and playlists continue to be checked by the existing Auto download scheduler.
- Newly discovered items are added to the persistent download queue without needing to reopen the app.
- Queued transfers continue or resume after temporary network loss, process recreation or Android background-work deferral.
- Long-running transfers use an Android-supported execution path and show a persistent progress notification while they are running.
- Existing quality, storage location, Wi-Fi/mobile-data, battery and free-space constraints remain respected.
- Already queued or completed items are not downloaded again.
- If Android interrupts a transfer, the item remains in the queue and resumes safely instead of being lost or falsely marked complete.
Source-code context
I checked the current implementation and found that a scheduler and background worker already exist:
- "AutoDownload.schedule()" registers unique periodic WorkManager work with a 3-hour interval. This is not an exact execution time; Android can defer it until the work constraints are met.
- "setSources()" also enqueues a one-time check when selected sources change.
- The worker uses network, battery-not-low and storage-not-low constraints. Wi-Fi-only is enabled by default.
- "AutoDownloadWorker" checks selected channel RSS feeds and playlists, queues eligible items, then calls "MobileDownloadService.startOrDrain()".
- In the background path, "startOrDrain()" tries to start "MobileDownloadService". If Android refuses that foreground-service start, the current code falls back to draining the queue directly on the WorkManager worker thread by running "DownloadJob" inline, without the download service's foreground progress notification.
Please investigate whether this fallback can finish long transfers reliably. A normal WorkManager "Worker" can be stopped when its execution window ends; WorkManager has a separate supported long-running-work path that promotes work with a foreground notification. Please choose an Android-compliant approach that fits the app's target SDK and current Android background-transfer rules.
The download registry and partial files should survive process death, and interrupted items should be resumable without restarting from zero when the source permits it.
Important
This is not a request to add another periodic scheduler or poll more frequently. Please fix the existing background execution and resume path rather than duplicating the current 3-hour WorkManager schedule.
Suggested verification
- Select at least one channel and one playlist in Settings > Downloads.
- Queue several videos, including a video large enough to take several minutes to download.
- Leave MeeTube in the background or dismiss its UI from Recents without using Android's Force stop.
- Verify that discovery and downloads continue or resume and that progress remains visible.
- Repeat with a temporary network disconnect and a process recreation; confirm that queue state and partial downloads are recovered safely.
An explicit Android Force stop can remain subject to Android's normal restrictions.
Anything else
Related: #203 introduced channel/playlist Auto download. The current source already contains the scheduler and download queue, so this issue is about reliability of their background execution, not adding Auto download from scratch.
Useful Android reference: https://developer.android.com/develop/background-work/background-tasks/persistent/how-to/long-running
Thanks a lot for digging into the code and writing this up so clearly, it made the fix easy to aim.
Fixed, it'll be in the next release:
- When Android won't start the download service from the background, the auto download check now downloads with the same progress notification (Pause and Cancel included). When its time window runs out, the video stops at its next piece, keeps what it already fetched and goes back in the queue, and a resume check carries on from there. A long video finishes across a few windows instead of getting cut off.
- Downloads cut off by the app being killed go back in the queue and resume on their own, picking up from the part files. Anything you paused yourself stays paused.
- On Android 15+, when the download service hits the daily dataSync limit it stops cleanly, the item goes back in the queue, and the resume check takes over.
- The existing 3 hour check, quality, folder, Wi-Fi only, battery and storage rules are unchanged, and the service and a background check can't take the same video at once.
Losing the network in the middle of a download still marks it failed for now (Retry picks up from the parts). If that bites you, let me know and I'll make it requeue too.