Changes in DownloadManager Behavior
From what I can tell,
relatively few apps use DownloadManager
for
downloading files from Web URLs. If your app happens to be one of them,
note that some DownloadManager
behavior has changed, in Android 5.0
and again in Android 6.0.
Specifically, starting with Android 5.0, the app behind DownloadManager
appears to be monitoring app uninstalls. If your app uses DownloadManager
,
and the user later uninstalls your app, exactly what happens depends
on the version of Android:
-
Android 4.4 and below are oblivious to the uninstall, so everything remains as it was prior to the uninstall.
-
Android 5.0 and 5.1 note the removal of your app and remove your app’s downloads from the list shown in the Downloads app. However, the files that were downloaded are still there for the user.
-
Android 6.0 not only removes your entries from the Downloads app, but also removes the downloaded files. This is true even if you specifically downloaded to a location that should survive an uninstall, such as via
setDestinationInExternalPublicDir()
.
Presumably, this is to help clean up cruft left behind by since-removed apps. However, the user may not realize that removing your app will also remove files that they obtained via your app.
Your primary options would seem to be:
-
Stop using
DownloadManager
-
Use
DownloadManager
, but then move the file away from the downloaded location, to some other place where the user can continue using the file even after uninstalling your app -
Use
DownloadManager
, but educate the user about needing to move the file themselves by one means or another, should they elect to uninstall your app