Question

Thanks to Navdeep I built a working DownloadManager. The thing is that I need the app to retry downloading failed download after a certain delay.

Similar to this post I added successfully an if-clause to check when a download is failed:

if (DownloadManager.STATUS_FAILED == c.getInt(columnIndex)) { ... }

The question is how I can restart the download. I guess the download is somewhere in the Query or Cursor?

Edit:

After fiddling around I'm trying to put a delay handler into this if-clause and call the download like I do it in the first place. Unfortunately I have problems accessing the COLUMN attributes:

c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));

This one causes a NullPointerException... Any ideas why?

Was it helpful?

Solution

You get a NullPointerException because the download has not been completed and so doesnt give a location to the downloaded file. You can call the method that downloads the file again if the download fails

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top