PRDownloader
PRDownloader copied to clipboard
resume download after app restart
Hi, after kill application The PRDownloader.getStatus(downloadId) alway return UNKOWN. I enabled database in config.
Does your server support pause-resume?
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
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 PRDownloader uses the RANGE header data from the database even after restarting the application.
@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
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.