Search code examples
androidandroid-pendingintentandroid-download-managernotificationmanager

PendingIntent and DownloadManager


Is there any way to set up a PendingIntent with the download manager? Or the DownloadManager.Request? I'm sending the user a notification in the toolbar about the download with this:

request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

request is initialized lik this:

DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));

I need it so that when the user clicks this notification they are brought to and activity or where the file was downloaded.


Solution

  • I think your question is answered in this question.

    That is, watch for ACTION_NOTIFICATION_CLICKED and ACTION_DOWNLOAD_COMPLETE actions.

    If you need more control you could use your own notification, updating it with your PendingIntent when the download is complete.