4

I am having trouble determining wether a download is still downloaded if the download's files were removed from storage through the file explorer.

I used the example code provided by the exoplayer team to implement my downloader.

I have a function that executes when the app returns to focus that loops through all the known downloads and uses the isDownloaded() function to determine whether each of the downloads is still downloaded. But when I delete all the files created by the download-manager in the file manager and I switch back to the app the function still returns true. Here is a snippet of the code:

for (int i=0; I<downloadIDs.size(); i++) {
    String stringUri = getUri(downloadIDs.get(i));
    if (stringUri != null) {
        Uri uri = Uri.parse(stringUri);
        if (downloadTracker.isDownloaded(uri)) {
            isDownloadedDownloadIDs.add(downloadIDs.getString(i));
        }
    }
}

The downloadID still gets added to the isDownloadedDownloadIDs ArrayList even though the files have been deleted.

Edit: Added java tag

Craig
  • 548
  • 9
  • 24

0 Answers0