How to upload multiple files using android DownloadManager so that it appears in one queue

I use DownloadManager to download files. I know how to upload one file and use

request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); 

or not. But I have several files that “belong” together in a sense, so I would like to have a “queue” for them and display a notification so that it shows the progress of the “queue” (for example, I added 5 files to the queue, therefore it will show 20% after downloading the first file, 40% after 2 of them, ...)

The order of the files is not important, but I would like to be able to detect in the BroadcastReceiver onReceive () function when the last queue file is loaded.

So far, the closest I have been able to not use request.setNotificationVisibility, count downloaded files, matching downloadId in onReceive () and do what I need to do when the last file is downloaded.

Is there a way to make this more “visible”?

+7
source share

All Articles