5

Using Android Download Manager i am trying to implement multiple download of pdf files synchronously (ie,an instance of the request is generated after successful completion of the previous request),soon after a DOWNLOAD_SUCCESS notification in the broadcast receiver,a duplicate copy of the same request(with the same request id ) is generated and the DownlaodManager is initiated implicitly.For the second time the download fails,and DownlaodManager gives DownloadManager.status = ERROR CANNOT RESUME.Hence,pdf is not downloaded.This happens only when i try synchronized multiple download. Any help is appreciated.

HjK
  • 3,513
  • 1
  • 17
  • 23

2 Answers2

1

I noticed that if you start another download immediately when current has finished, this error occurs. So, I solved this problem by inserting a sleep time in the current Thread between the finish and the start of the next download... I used Thread.sleep(1000), but you can try others values. (make sure you are not doing it in UIThread). Works nice for me ;)

Gilian
  • 422
  • 7
  • 12
0

Are you running your app on the Samsung device? I have the same problem with Nexus S, Galaxy Tab 10.1 and one which name I can't remember (they have Android versions 2.3.6, 3.2 and 4.0.4) but never on the HTC Nexus One, HTC Sensation (4.0.x) and HTC Explorer (2.3.5) or emulator.

I have this consequence:

06-05 17:42:26.756: INFO/DownloadManager(12113): Initiating request for download 1551
06-05 17:42:27.057: INFO/ololo(17021): Status for content://downloads/my_downloads/1551: file exists
06-05 17:42:27.137: INFO/DownloadManager(12113): Initiating request for download 1551
06-05 17:42:27.197: WARN/DownloadManager(12113): Aborting request for download 1551: Trying to resume a download that can't be resumed
06-05 17:42:27.247: WARN/ImageView(17021): Unable to open content: content://downloads/my_downloads/1551

I think this is very interesting problem.

There people say that this is Samsung and some other vendors issue. My solution is to implement my own DownloadManager or use someone's else.

efpies
  • 3,625
  • 6
  • 34
  • 45