When we download the file from web server it first stored in phone memory and at define moments the data are flushed on the SD card to not fill up the RAM.
But when the connection crashes, users set the phone to fly mode, leaves the WLAN coverage area, etc. normally the file download must be started from the beginning.
This is both waste of time and money for user and waste of network resources and phone battery.
To be able to continue an interrupted download we plan to use the Range HTTP headers. What is the correct use for that?
Do we need to remember the original length of the file from the Content-Length header or we should send HEAD instead (that should give us the actual file size…) or there is not need to store the original size and send in the next HTTP GET request following headers and skipping the final file size (below I assume that 555bytes was already downloaded):
Accept-Ranges:bytes
Range: 555-
Thanks and regards,
STeN
You don’t need the full file size, but you should use the
header, and you must also verify that the server can handle your request, and that it replies with