I managed to work out my problem. In the BroadcastReceiver
I had to get the download id from the intent and remove that from the DownloadManager
.
BroadcastReceiver onComplete = new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {
Toast.makeText(getApplicationContext(), "Download Completed", Toast.LENGTH_SHORT).show();
// Get the download_id of the completed download.
long download_id = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1);
// Remove the completed download from the DownloadManager
mDownloadManager.remove(download_id);
}
};
I also want to note that by doing mDownloadManager.remove(download_id)
, this will delete the file from memory. I had to add additional code to save the file permanently in the location I wanted it to save originally.