0

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.

4

1 回答 1

2

您应该阅读以下有关 DOWNLOADMANAGER 的文档...

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

我还有一个常量ACTION_VIEW_DOWNLOADS,它启动一个活动来显示上述文档中的所有下载。

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

编辑

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);

借助上述代码,您可以显示应用的下载历史记录。

于 2012-02-08T07:03:02.217 回答