
The follow code snippet shows you how to create a new intent whose action name is .first.broadcast: Intent myIntent = new Intent(".first.broadcast")

Although the action name can be any string, I recommend that you always prefix it with the package name of your app in order to avoid conflicts with broadcasts of other applications. If you haven't read it yet, now would be a good time to do so.Įvery intent you send as a broadcast must have an action name. This series has a detailed tutorial about intents. Therefore, before you create a broadcast, you must create an Intent object. I'll also show you how to use a third-party library called EventBus that can serve as an alternative to local broadcasts.Īndroid broadcasts are sent in the form of Intent objects. In this tutorial, I'll show you how to create, send and receive both local and system-wide broadcasts.

Such announcements are called broadcasts, and they are seen as an important form of asynchronous inter-process communication on the Android platform.

Android applications also have to deal with announcements sometimes-announcements generated either by other applications or by the Android operating system itself. They are loud messages that are meant to inform large groups of people about something important. Most of us are all too familiar with announcements in public places.
