I have a bunch of files to download (simultaneously, if possible). So I register N BroadcastReceivers for ACTION_DOWNLOAD_COMPLETE
and enqueue N requests.
Okay, everything is going better than expected until I receiving Intent broadcasted by DownloadManager. Yes, EVERY receiver receives this Intent.
Hmm. I can fetch a row for a specific download ID (which DownloadManager.enqueue
returns) and check if the status of the file with the URL linked to this receiver is STATUS_SUCCESSFUL
, do what I need and then unregister receiver.
But... You know, it isn't the best way to do this.
Is there a way to determine URL or some other info from intent or does DownloadManager only notify my when something is done? Or how do I handle multiple downloads at the same time?