开发者

how to Get a list of applications being download?

In my application, I need to know if a particular app is being downloaded from the android market or not. How Do I achieve this functionality? Is it possible to get a list of all the downloads that are in pr开发者_如何转开发ogress?Does the android market broadcast any intents that can be caught?

Note:Since my target application is on android 3.0+ devices therefore, I have no issues with using the DownloadManager class(which is 2.3 onwards).


I found an API that will accomplish what you want but you need to have an API of 9 or higher to use it. You can get all the downloads that have been requested for download from a download manager by using this:

DownloadManager manager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Query query = new DownloadManager.Query();
Cursor c = manager.query(query);

You can get more information on this here. I don't think there are any other methods available that will give you this information at a lower API level.


I dont think that there are any android market application intents you can catch (but I'm not 100% sure because I can't find android market app manifest nowhere).

As I see it, through the DownloadManager.query(DownloadManager.Query q) class you should be able to find all the ongoing downloads and by source of the data you could exclude all which are not download from market.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜