Pump
Pump copied to clipboard
how to auto resume download and show custom notification?
I have found this library newly. It's really perfect but I have just two problems:
- 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?
- How I can show custom notification in the notification bar showing the current download progress and It's other info?
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.
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?
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.
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.
Download server list first and build a download list by listening download progress.