Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanupDestination? Files getting deleted after download?I have downloaded same picture. #112

Open
VikasPawar2112 opened this issue Dec 25, 2017 · 0 comments

Comments

@VikasPawar2112
Copy link

I want to download duplicate pictures and save them as picid(1),picid(2) etc.
I used to same url to download picture and i am saved the those picture as picture id.
So, they don't save into gallery.
It show D/ThinDownloadManager: cleanupDestination() deleting /storage/emulated/0/Pictures/ShareApp/Pic74402848.jpg
So, it's possible to download duplicate pictures.

Here is my code:
public void download(List pictureList) {
this.pictureList = pictureList;
Random random = new Random();
for (Picture picture : pictureList) {
RetryPolicy retryPolicy = new DefaultRetryPolicy();
Uri downloadUri = Uri.parse(picture.getPicUrl());
DownloadPictures.downloadIssue("Before Downloaded Picture Name" + picture.getPicUrl());
String fileName = "Pic" + picture.getPicId()/System.currentTimeMillis() + random.nextInt()/ + ".jpg";
Uri destinationUri = Uri.parse(shareAppFile + "/" + fileName);
DownloadRequest downloadRequest1 = new DownloadRequest(downloadUri)
.setDestinationURI(destinationUri).setPriority(DownloadRequest.Priority.LOW)
.setRetryPolicy(retryPolicy)
.setDownloadContext(picture.getPicId())
.setStatusListener(downloadStatusListenerV1);
downloadRequests.add(downloadManager.add(downloadRequest1));
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant