Android Tutorial

(avery) #1

By : Ketan Bhimani


94 

listening for Intent objects. These types of Intent objects are
generally used to inform the greater system that something
interesting has happened and use special Intent Action types.

For example, the Intent action ACTION_BATTERY_LOW broadcasts
a warning when the battery is low. If your application is a battery-
hogging Service of some kind, you might want to listen for this
Broadcast and shut down your Service until the battery power is
sufficient. You can register to listen for battery/charge level
changes by listening for the broadcast Intent object with the Intent
action ACTION_BATTERY_CHANGED. There are also broadcast
Intent objects for other interesting system events, such as SD card
state changes, applications being installed or removed, and the
wallpaper being changed.

Your application can also share information using the broadcast
mechanism. For example, an email application might broadcast
Intent whenever a new email arrives so that other applications
(such as spam or anti-virus apps) that might be interested in this
type of event can react to it.
Free download pdf