I developing an application like Internet Download Manager for Android.
I want to know how to download different parts of file in Android as it is done in IDM.
How can I get the metadata of file before download and how to download files in parts?
There is no username-password or any restrictions in downloading... just simple download by url.
Assuming you're using HTTP for the download, you'll want to use the HEAD
http verb and RANGE
http header.
HEAD
will give you the filesize (if available), and then RANGE
lets you download a byte range.
Once you have the filesize, divide it into roughly equal sized chunks and spawn download thread for each chunk. Once all are done, write the file chunks in the correct order.
EDIT:
If you don't know how to use the RANGE
header, here's another SO answer that explains how: https://stackoverflow.com/a/6323043/1355166
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With