Pump icon indicating copy to clipboard operation
Pump copied to clipboard

how to auto resume download and show custom notification?

Open aazam-nouri opened this issue 6 years ago • 5 comments

I have found this library newly. It's really perfect but I have just two problems:

  1. when I go out of the download activity and come back, the download progress is paused and I have to start it again manually; How I can start it programmatically not manually when I come back to the activity?
  2. How I can show custom notification in the notification bar showing the current download progress and It's other info?

aazam-nouri avatar Nov 28 '18 10:11 aazam-nouri

1.You can get downloadTask list at start of Activity,and resume download; 2.Pump only care download, you can start a notifycation by youself when received downloadInfo.

huxq17 avatar Nov 29 '18 02:11 huxq17

Thanks for your response. In your sample; you are initiating and starting your whole download list in main activity before opening download list activity and your download list is providing from your download service, How can I initiate an start a download from a typical list item not list provided from the download service?

aazam-nouri avatar Dec 03 '18 12:12 aazam-nouri

Download need url and filePath, and you can get them from downloadInfo,then you can start a download task.looks like this:

Pump.newRequest(downloadInfo.getUrl(), downloadInfo.getFilePath())
        //Optionally,Set whether to repeatedly download the downloaded file,default false.
        .forceReDownload(true)
        //Optionally,Set how many threads are used when downloading,default 3.
        .threadNum(3)
        .submit();

By the way, threadNum should be same as last download,otherwise the download will start all over again.

huxq17 avatar Dec 03 '18 13:12 huxq17

Thanks, but my list is providing from the server side and I don't have any download info at first, I don't know how I can manage that.

aazam-nouri avatar Dec 22 '18 05:12 aazam-nouri

Download server list first and build a download list by listening download progress.

huxq17 avatar Dec 22 '18 08:12 huxq17