How to Pause/Resume downloads in Android programming?
Asked Answered
N

0

1

I really want to use android.app.DownloadManager class, also I want to add Pause/Resume ability to my android app.

as google said on developer Guide :

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

I guess we can add Pause/Resume ability to this class without writing a new Download Manager, Like : DownloadProvider

can anybody help me ?

Narrative answered 4/3, 2015 at 16:57 Comment(7)
Based on the documentation, there is no pause/resume capability, only ability to cancel. This is likely because many servers may not support resumable downloads.Ebracteate
@Ebracteate please see this post, I don't know how to implement it : #16340876Narrative
Your comment is hardly helpful as you only link to another question asking the same thing. It is not possible with the download manager. If you must have it, you'll need to implement your own download manager, but that's far too broad a question for this forum.Ebracteate
@Ebracteate please run this scenario: 1. Start download with android download manager 2. After a while, Force stop download manager 3. Start it again, you will see that your downloading will be resume if your download server support it, so android download manager handle pause/resume it's self, on the other hand, in source code of android download manager you can see this status : status_Pause_*,Narrative
Its seems that android download manager have a service that change status of downloading file for different situations like intrupted or network change to Status_Pause, on ther hand, suppose you set download file only when you use wifi connection, when your connection changed to cellar network, your download will be pause until your network connection back to wifi, all of this shows that android download manager can handle pause or resume ( if server support it ), may be we can extend this class to add Pause/Resume methods, are you agree?Narrative
Yes, Android download manager is smart enough to resume if the server supports it. Not all do. However, trying to force the API to do something that isn't supported may not work, may not work on all devices, in all api versions and/or may break at any time. No serious programmer would attempt that for something that is non-essential. If mobile data-usage is a concern, then set that up when you queue the download.Ebracteate
Please check below answer https://mcmap.net/q/1924833/-android-how-to-pause-and-resume-using-downloadmanagerAttaboy

© 2022 - 2024 — McMap. All rights reserved.