-->

How to identify which file triggered Download_Comp

2019-07-20 09:59发布

问题:

I'm developing an application that will Download another apk file, and asks for it's installation.

Since my target is GingerBread I'm using the DownloadManager class.

Is there anyway to know which downloaded file triggered the DOWNLOAD_COMPLETE intent?

回答1:

It's stored in EXTRA_DOWNLOAD_ID:

public static final String EXTRA_DOWNLOAD_ID

Since: API Level 9

Intent extra included with ACTION_DOWNLOAD_COMPLETE intents, indicating the ID (as a long) of the download that just completed.

Constant Value: "extra_download_id"

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