Search code examples
androidbroadcastreceiverdownload-manageridentify

How to identify which file triggered Download_Complete intent


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?


Solution

  • 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