Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resume download from Download Manager android when download is failed

Tags:

android

I am using DownloadManager service to download files. I want it to resume the download if it is failed by any case(for example internet got disconnected). I am saving the download id generated when we enqueue the request for download. Can I resume download using that id? Or with any other method?

EDIT: Code of my Download Service: http://pastie.org/8613353

like image 282
berserk Avatar asked Jan 08 '14 09:01

berserk


2 Answers

It's good habit to check documentation first. DownloadManager documentation says:

The download manager will conduct the download in the background, taking care of HTTP interactions and retrying downloads after failures or across connectivity changes and system reboots.

like image 164
Marcin Orlowski Avatar answered Oct 30 '22 00:10

Marcin Orlowski


Thanks to @Marcin's suggestion, I checked the documentation for DownloadManager. The problem with the link I posted was that it was not having resume capability. That's why after it failed due to internet disconnection, it won't resume. I tried other links with resume capability, and they all resume perfectly after internet re-connection.

like image 39
berserk Avatar answered Oct 29 '22 23:10

berserk