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 andRANGE
http header.HEAD
will give you the filesize (if available), and thenRANGE
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