Broadcast Receivers

A broadcast receiver is another component of an Android process, along with activities, content providers, and services. As the name indicates, a broadcast receiver is a component that can respond to a broadcast message sent by a client. The message itself is an Android broadcast intent. A broadcast intent (message) can invoke (or be responded to by) more than one receiver.

A component such as an activity or a service uses the sendBroadcast() method available on the Context class to send a broadcast event. The argument to this method is an intent.

Receiving components of the broadcast intent will need to inherit from a Receiver class available in the Android SDK. These receiving components (broadcast receivers) then need to ...

Get Pro Android 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.