Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top