2

There is info that Android's DownloadManager support ETags. Okay, I have a server with ETag support (e.g. DropBox). When I'm trying to download a file DownloadManager creates a new one and appends a number to the local filename (e. g. file.zip, file-1.zip, file-2.zip etc.). Is there a way not to download an existing file with same ETag? My app will be downloading huge files so I don't want to reload them every time.

efpies
  • 3,625
  • 6
  • 34
  • 45

1 Answers1

3

Is there a way not to download existing file with same ETag?

You are the one requesting the downloads. You need to determine what files should and should not be downloaded. AFAIK, DownloadManager only uses ETag for interrupted downloads -- it does not store ETag information indefinitely.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • In other words, I should (somehow) store this info and make decisions whether to execute requests or not by myself? – efpies Jun 04 '12 at 17:29
  • @efpies: You don't have much of a choice. If `ETag` comes down on an HTTP `HEAD` request, you could issue your own `HEAD` request via `HttpUrlConnection`, see if the file needs updating, and then conditionally set up the `DownloadManager.Request`. – CommonsWare Jun 04 '12 at 18:05