berserk
berserk

Reputation: 2728

Resume download from Download Manager android when download is failed

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

Upvotes: 8

Views: 13077

Answers (2)

berserk
berserk

Reputation: 2728

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.

Upvotes: 1

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

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.

Upvotes: 2

Related Questions