Download Manager Unable to Resume Download in case of Internet Disconnection and System Reboot

download manager pause and resume android
how to resume failed download in chrome pc
how to resume interrupted download in internet explorer
how to resume interrupted download in microsoft edge
how to resume download in chrome after shutdown
android-download manager complete notification
samsung download manager
where is download manager

I have created a simple application which is supposed to download large zip files. After some R&D I came to the conclusion that I have to use Download Manager to achieve this. I want the download to resume automatically if the device is restarted or in case of unstable internet connectivity. Right now, the code is able to download large files as expected, but in case of internet connectivity fluctuations or system restart, it stops downloading.

The activity:

public class MainActivity extends ActionBarActivity {

    String Download_path = "";
     String Download_ID = "DOWNLOAD_ID";

     SharedPreferences preferenceManager;
     DownloadManager downloadManager;

    protected void onCreate(Bundle savedInstanceState) {
        preferenceManager = PreferenceManager.getDefaultSharedPreferences(this);
           downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);

           Button btnDownload = (Button)findViewById(;
           btnDownload.setOnClickListener(new Button.OnClickListener(){

       public void onClick(View arg0) {

        // Locate storage location
            String filepath = "";

            File folder = new File(
                    Environment.getExternalStorageDirectory() + "/osmdroid");
            boolean success = true;
            if (!folder.exists()) {
                success = folder.mkdir();
            if (success) {
                // Do something on success
                filepath = Environment.getExternalStorageDirectory()
                        .getPath() + "/osmdroid";

                // Deleting if zip file exists
                File folder2 = Environment.getExternalStorageDirectory();
                String fileName = folder2.getPath() + "/osmdroid/";

                File myFile = new File(fileName);


    //Starting download manager to download file
        Uri Download_Uri = Uri.parse(Download_path);
        DownloadManager.Request request = new DownloadManager.Request(Download_Uri);

        long download_id =  downloadManager.enqueue(request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |DownloadManager.Request.NETWORK_MOBILE)
                .setDescription("Map Download")

       // long download_id = downloadManager.enqueue(request);

        //Save the download id
        Editor PrefEdit = preferenceManager.edit();
        PrefEdit.putLong(Download_ID, download_id);

     protected void onResume() {
      // TODO Auto-generated method stub

      IntentFilter intentFilter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
      registerReceiver(downloadReceiver, intentFilter);

     protected void onPause() {
      // TODO Auto-generated method stub


     private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {

      public void onReceive(Context arg0, Intent arg1) {
       // TODO Auto-generated method stub
       DownloadManager.Query query = new DownloadManager.Query();
       query.setFilterById(preferenceManager.getLong(Download_ID, 0));
       Cursor cursor = downloadManager.query(query);

        int columnIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);
        int status = cursor.getInt(columnIndex);
        int columnReason = cursor.getColumnIndex(DownloadManager.COLUMN_REASON);
        int reason = cursor.getInt(columnReason);

        if(status == DownloadManager.STATUS_SUCCESSFUL){
         //Retrieve the saved download id
         long downloadID = preferenceManager.getLong(Download_ID, 0);

         ParcelFileDescriptor file;
         try {
          file = downloadManager.openDownloadedFile(downloadID);
            "File Downloaded: " + file.toString(),
         } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block

        }else if(status == DownloadManager.STATUS_FAILED){
           "FAILED!\n" + "reason of " + reason,
        }else if(status == DownloadManager.STATUS_PAUSED){
           "PAUSED!\n" + "reason of " + reason,
        }else if(status == DownloadManager.STATUS_PENDING){
        }else if(status == DownloadManager.STATUS_RUNNING){



Where am I going wrong? What should I do to enable the resume capability of the download?

Quoting from docs,

The download manager will conduct the download in the background, taking care of HTTP interactions and retrying downloads after failures or across connectivity changes and system reboots.

I guess Download Manager, by default takes cares of retries.

If you are having issues you can use DownloadManager.Query class and query for COLUMN_STATUS and COLUMN_REASON to get the download status


Starting a download
dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request( YOUR_DOWNLOAD_URL );
long enqueue = dm.enqueue(request);

enqueue is more like a download reqeust id. You can use that enqueue to fetch the download progress/status

Querying the download Status
Query query = new Query();
Cursor c = dm.query(query);
if (c.moveToFirst()) {

    int downloadStatus = c.getInt(c.getColumnIndex(DownloadManager.COLUMN_STATUS));

    if (DownloadManager.STATUS_SUCCESSFUL == downloadStatus) {
        // download succeded
    } else if (DownloadManager.STATUS_FAILED == downloadStatus){
        String failedReason = c.getString(c.getColumnIndex(DownloadManager.COLUMN_REASON));
        // handle failures

Haven't tested the code myself. But it should work.

How to Resume a Download After a Lost Connection, The ability to resume interrupted downloads can save you a lot of time, All major browsers, including Firefox, Internet Explorer and Chrome, enable you to resume a download from where Resume a failed download with major Web browsers. in case of a lost connection, so your download will pause, but it won't be lost. Thanks to @Marcin's suggestion, I checked the documentation for DownloadManager. The problem with the link I posted was that it was not having resume capability. That's why after it failed due to internet disconnection, it won't resume. I tried other links with resume capability, and they all resume perfectly after internet re-connection.

Try to get the reason for the failed download. e.g does it work on network switch wifi->data

(If your error reason is 1008- there seems to be a reported bug here,


Interrupted Download in Google Chrome? How to Resume , Here's how you can successfully resume failed downloads in Google Chrome. Your internet connection can be uncertain at times, and a sudden drop in the connectivity In such a case, you'll experience a partial download no matter which browser you use. Use Chrome's Download Manager to Resume Downloads. Above is the Way to Resume Download of Broke Files in IDM (Internet Download Manager). There are Millions of user Who Have Installed IDM on their Computers So Sometimes a Resuming Problem is faced by Users So This Simple Trick is Help you to Resume Download of Broken Files in IDM.

I confirm that this problem still exists in 2020, when testing in an emulator and having WiFi enabled, this error consistently appears (even with Android 10).

Switching off WiFi in the emulator seems to solve the problem.

How can I resume an interrupted Firefox download?, When you download a file using Firefox, it creates two files: one is named as the So, let's say your internet connection failed and the download was interrupted. the server supports it, otherwise it might restart your download from the beginning, of Firefox have a "Retry" button nxt to the file in the download manager. This statement of yours ' Internet Explorer does not support for interrupted download; however, it all depends on the server you download from and the software you use to download. And if a download is interrupted, you'll be able to quickly resume downloading the next time you start Internet Explorer 9. '' seems to be self-contradicting.

How to Fix and Continue Broken or Corrupted IDM Downloads , Internet Download Manager (IDM) is a download accelerator and file in which case IDM could not merge the file and complete the download. Your system needs to have the capability to resume download, which Find the folder of the corrupted file (the one that failed to download After rebooting. I would recommend Orbit Downloader. The best download accelerator ever. It has the ability of pausing and resuming the downloads. The one good upside about orbit downloader is that the process of downloading won't die if you lose the connection for a short while, say 1 to 2 mins.

How to Resume an Interrupted Download in Google Chrome, An internet connection can be unpredictable at times, and a sudden drop of However, Google Chrome lets you resume downloads if they Google Chrome uses a built-in download manager to display all your downloads—active, failed, will resume from where it left off before you were disconnected. That said, what the tool essentially does in one form or the other is download the necessary files (about 3.5GB worth if you’re downloading the 64bit version) needed to install Windows 10 to your system. Regardless of how fast an internet connection you have, if your download fails you don’t want to have to sit through all of it again.

Download paused in play store and doesn't resume, bro i am also using m5 just do one thing. when your download pause just go out and close play store from left button and your internet connection. wait for 30� Unfortunately, a stable internet connection can drop out right when you need it the most, in the middle of an important download. No matter if it's because of a bad router, a problem with your

  • Please give me some sample code suggestions or snippets
  • @kittu88, please see the above edit. I've attached sample code, but haven't tested though.
  • @bhargavg : change the failedReasion to int and do c.getInt . see the below code : int reason = cur.getInt(cur.getColumnIndex(DownloadManager.COLUMN_REASON)); if (reason == DownloadManager.ERROR_INSUFFICIENT_SPACE) { //do wat ver u want to do }