Using Intents to Broadcast Events

As a system-level message-passing mechanism, Intents are capable of sending structured messages across process boundaries.

So far you've looked at using Intents to start new application components, but they can also be used to broadcast messages anonymously between components via the sendBroadcast method. You can implement Broadcast Receivers to listen for, and respond to, these broadcast Intents within your applications.

Broadcast Intents are used to notify listeners of system or application events, extending the event-driven programming model between applications.

Broadcasting Intents helps make your application more open; by broadcasting an event using an Intent you let yourself and third-party developers react to events without having to modify your original application. Within your applications you can listen for broadcast Intents to replace or enhance native (or third-party) applications, or react to system changes and application events.

Android uses broadcast Intents extensively to broadcast system events like battery-charging levels, network connections, and incoming calls.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment