Search code examples
androidandroid-intentbroadcastreceiverintentfilter

How do I set a broadcast receiver


I want to set a broadcast receiver to run some function when it gets the broadcast message, in this example, I want to catch the download's manager intent:

DownloadManager.ACTION_DOWNLOAD_COMPLETE

I looked at the Android API examples and haven't found a way to do this


Solution

  • You should read this first:

    http://developer.android.com/reference/android/content/BroadcastReceiver.html

    Then look here for examples.

    Android Samples: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleBroadcastReceiver.html

    Blog post: http://www.androidcompetencycenter.com/2009/01/basics-of-android-part-ii-intent-receivers/