O'Reilly logo
  • Karthik Rajagopalan thinks this is interesting:

If you would like to receive the events only when your activity is visible, onPause is the best place to turn off the receiver. If you’d like to listen for as long as your activity is running, even if it’s not visible, you’ll want to unregister in onDestroy. Wherever you decide to stop listening, simply call unregisterReceiver (a method implemented by your superclass) and pass in the BroadcastReceiver


Cover of Beginning Android Programming: Develop and Design


Unregistering the broadcast receiver.