I have implemented this library to download files from the list of items displayed to the user in a view pager. Each item of the view pager can be downloaded. If for example, the user is downloading a file which has a download Id "1" and he comes out of the app while the download goes in the background. Again the user enters the app and now starts download of another file. This time too the new file is given download Id as "1". Due to this, I am unable to display progress of the download to the users because both the downloads have the same Id.
Everytime the user enters the app, I setup download manager as below.
private void setupDownload() {
OkHttpClient client = new OkHttpClient.Builder().build();
downloadManager =
new DownloadManager.Builder().context(this)
.downloader(OkHttpDownloader.create(client))
.threadPoolSize(1)
.logger(new Logger() {
@Override
public void log(String message) {
Log.d(TAG, "Log message: " + message);
}
})
.build();
}
@Override
public void onStart(int downloadId, long totalBytes) {
.....