Read complete story

Downloading files using Download Manager in Android

Download Manager is a system service which optimizes the handling of long-running downloads in the background. If you want to download large files/streaming you can use  Android Download Manager.  The download manager handles HTTP connections, monitors connectivity changes, reboots, and ensures each download completes successfully.

Add the following permission to your AndroidManifest.xml file:

First, we will have to generate URI from URL.

On click of the  button, write the below mentioned code.

In the above code, We are passing a request to the Download Manager with the download file URL, Title and Description to be shown in notification bar etc. We can also specify whether the download should happen over wifi or cellular or both.

Thanks for reading.

. . .

Comments (2)

Add Your Comment

  • franklyn
    manager.enqueue(request);
    where did this come from not working
    • saumya dubey
      Thanks for reporting the issue.
      Please check the updated code – downloadManager.enqueue(request);
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close