9

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?

besam
  • 155
  • 6

1 Answers1

5

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
}
   };
Opiatefuchs
  • 9,800
  • 2
  • 36
  • 49
  • 1
    I use android 2.2, Is it possible in this version? – besam May 27 '14 at 13:06
  • 1
    no, it´s added in API9, for alternative handling, see this post: http://stackoverflow.com/questions/10908375/how-to-create-own-download-manager-in-android-2-2 – Opiatefuchs May 27 '14 at 13:11