Reputation: 151
Does Android provide an API for pausing / resuming downloads (other than download manager)?
I have a task to download large size of file using background service. I have implemented the background services.
But if the network disconnected while the file is being downloaded the file gets corrupted, even if I try to resume from the same place where the previous download stopped. Does Android provide any API for resume the download process from where its left, so that the process will continue from the same place even if the network is disconnected and reconnected?
Upvotes: 0
Views: 1751
Reputation: 943
For pause-resume downloads make sure that your server supports resumable downloads. Then You have to perform following steps:
connection.setRequestProperty("Range", "bytes=" + bytedownloaded + "-");
Or you can try an open source library which I have not tried
https://github.com/yingyixu/android-download-manager
Upvotes: 2