PRDownloader icon indicating copy to clipboard operation
PRDownloader copied to clipboard

resume download after app restart

Open hossein-rezaeian opened this issue 5 years ago • 6 comments

Hi, after kill application The PRDownloader.getStatus(downloadId) alway return UNKOWN. I enabled database in config.

hossein-rezaeian avatar Jul 09 '19 06:07 hossein-rezaeian

Does your server support pause-resume?

amitshekhariitbhu avatar Jul 16 '19 18:07 amitshekhariitbhu

The downloaded file size(s) has been saved to database for you enable database. when restart app download, PRDownloader will read downloaded file size(s) from database, and set http header "Range:bytes=xxx-", so it resume download again.

xxx is downloaded file size number

rigortek avatar Oct 23 '19 08:10 rigortek

PRDownloader does not receive data from the database. The database itself has the necessary data for requests, but PRDownloader does not use them after restarting the application. After a restart, the status is always UNKOWN.

AlexanderFilinovich avatar Oct 25 '19 02:10 AlexanderFilinovich

@AlexanderFilinovich PRDownloader uses the RANGE header data from the database even after restarting the application.

amitshekhariitbhu avatar Oct 25 '19 04:10 amitshekhariitbhu

@amitshekhariitbhu, if you have free time, please explain how, after restarting, the filling of "private final Map <Integer, DownloadRequest> currentRequestMap" in the DownloadRequestQueue class occurs, from which we then call the method "public void resume (int downloadId)"? Thank! P.S. The same issue is described at https://github.com/MindorksOpenSource/PRDownloader/issues/71

AlexanderFilinovich avatar Oct 25 '19 09:10 AlexanderFilinovich

The currentRequestMap is not getting filled from the database because we can't be sure about "which request is gonna resumed by the users". Even if you start the download after application restarts, the downloading happens with a resume that takes the data from the database to resume from which point using the RANGE header. I think, we can do something to make this simpler.

amitshekhariitbhu avatar Oct 25 '19 09:10 amitshekhariitbhu