Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting message when downloading has been completed

I'm trying to use android default download manager in my app, but problem is that i don't get any message in my app when download has been completed. Is there any way to solve this problem?

like image 592
besam Avatar asked May 27 '14 12:05

besam


1 Answers

You need to register a BroadcastReceiver to know when it is completed:

    registerReceiver(completionReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));

The Receiver:

    BroadcastReceiver completionReceiver = new BroadcastReceiver() {
public void onReceive(Context ctxt, Intent intent) {

     //here You know the download is complete, do whatever You want to do
}
   };
like image 164
Opiatefuchs Avatar answered Sep 21 '22 15:09

Opiatefuchs