Search code examples
androiddownloaddownload-manager

Android download history


is there any way to know through code what are all download requests I made in past and their download status. i.e simply I want to know download history. Note: Download requests can be made from browser or from any other apps Thanks in Advance

Edit

himanshu solution is giving download request made from my app but not from browser or other apps. Can anybody provide some more help.


Solution

  • You should read the following documentation about DOWNLOADMANAGER...

    http://developer.android.com/reference/android/app/DownloadManager.html

    and i also got a constant ACTION_VIEW_DOWNLOADS which launchs an activity to display all downloads in the above doc.

    http://developer.android.com/reference/android/app/DownloadManager.html#ACTION_VIEW_DOWNLOADS

    EDIT

    DownloadManager.Query query = null;
    downloadManager = (DownloadManager)getSystemService(DOWNLOAD_SERVICE);
    query = new DownloadManager.Query();
    query.setFilterByStatus(DownloadManager.STATUS_FAILED|DownloadManager.STATUS_PENDING|DownloadManager.STATUS_RUNNING|DownloadManager.STATUS_SUCCESSFUL);
    

    With the help of the above code you can show download history from your app.