Support moving download location (e.g., between internal and external storage)
See original GitHub issue[REQUIRED] Use case description
I’m trying to implement a way for users to switch from internal storage to external storage (e.g. SD card), and I want to preserve all downloads when doing that. I’m releasing the current cache, copying all the files, and creating a new cache pointing to the new directory (I’m using SimpleCache
). I’m also creating a new DownloadManager
with the new cache, but in the end that doesn’t matter because the DownloadService
will still be stuck to the old DownloadManager
(pointing to the old cache) thanks to the static downloadManagerListeners
that hold the DownloadManagerHelper
which holds the DownloadManager
.
Proposed solution
Ideally it’d be great if we had an API that would do all the work needed to switch between internal storage to external storage. But if we have a way to simply update the DownloadManager
instance held by DownloadService
, we’d be able to do the rest ourselves.
Alternatives considered
At first I thought we could simply have a protected method that clears the downloadManagerListeners
, but I don’t fully understand its purpose yet, so I’m not sure whether that’s reasonable or not.
On our end one solution is to simply kill the process and restart the app, but that’s definitely overkill and would be far from good to the users.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:21 (4 by maintainers)
Top GitHub Comments
Ability to switch between internal-storage and sd-card would be a very welcome enhancement!
Here’s my current reflection code for future reference, since it seems this might be useful for other people: