I want to download a big (zip) file from my server. It's about 440MB. I'm using android download service.
Here is my code:
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request(Uri.parse(SERVER_PATH));
request.setTitle(getString(R.string.title_download));
request.setDescription(getString(R.string.desc_download));
File mapDir = new File(Environment.getExternalStorageDirectory() + DEVICE_PATH_PART);
File mapPartFile = new File(Environment.getExternalStorageDirectory() + DEVICE_PATH_PART + MAP_PACKFILE + EXT_INPROGRESS);
request.setDestinationUri(Uri.fromFile(mapPartFile));
enqueue = dm.enqueue(request);
Download start fine. I can see my file in download manager. But when occurs some network problems (connection break), download finish with error 1008 and partial file is removed from my directory. And this is my problem and question: How can I force download service to not remove partially file from my destination directory, in order to resume download process ?
The side question or problem is: when I downloading 440meg file from my app, then download process is breaks many times (with cant resume error and after that with no possibility do resume download). But if I download same file through download manager application directly in android, everything is ok. And I don't know why. The only error I'm getting in receiver is 1008 about cant resume. Is there anybody with same problem?
Thank you.