0

I am creating an Android mobile application where I have the following requirements.

i>When the end-user clicks on any of the list items(thumbnail images) displayed on the screen , the video corresponding to the image starts to download from the server & ultimately the video is saved on a specific location of the mobile device.

Now , when there is a network failure , the download fails but the requirement is that , from the next time onwards , the downloading of the video file should start from the same place from where it was disconnected.

Kindly provide me the suggestions/tips/sample code to how to maintain the state of the downloads so that it gets started from the same place next time.

Thanks in advance.

Warm Regards,

CB

1 Answer 1

1

I know theory but not code.

  1. you should record where the download item stopped, say offset 1234 from beginning
  2. set “Range: bytes=1234-” as a header parameter to the request when continue to download the item

use HttpRequest.setHeader ("Range", "bytes=1234-") to set the header if you are using org.apache.http.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.