Many of the system Services broadcast Intents to signal changes. You can use these messages to add functionality to your own projects based on system events, such as time-zone changes, data-connection status, incoming SMS messages, or phone calls.
The following list introduces some of the native actions exposed as constants in the Intent class; these actions are used primarily to track device status changes:
- ACTION_BOOT_COMPLETED — Fired once when the device has completed its startup sequence. An application requires the RECEIVE_BOOT_COMPLETED permission to receive this broadcast.
- ACTION_CAMERA_BUTTON — Fired when the camera button is clicked.
- ACTION_DATE_CHANGED and ACTION_TIME_CHANGED — These actions are broadcast if the date or time on the device is manually changed (as opposed to changing through the inexorable progression of time).
- ACTION_MEDIA_EJECT — If the user chooses to eject the external storage media, this event is fi red first. If your application is reading or writing to the external media storage, you should listen for this event to save and close any open file handles.
- ACTION_MEDIA_MOUNTED and ACTION_MEDIA_UNMOUNTED — These two events are broadcast whenever new external storage media are successfully added to or removed from the device, respectively.
- ACTION_NEW_OUTGOING_CALL — Broadcast when a new outgoing call is about to be placed. Listen for this broadcast to intercept outgoing calls. The number being dialed is stored in the EXTRA_PHONE_NUMBER extra, whereas the resultData in the returned Intent will be the number actually dialed. To register a Broadcast Receiver for this action, your application must declare the PROCESS_OUTGOING_CALLS uses-permission
- ACTION_SCREEN_OFF and ACTION_SCREEN_ON — Broadcast when the screen turns off or on, respectively.
- ACTION_TIMEZONE_CHANGED — This action is broadcast whenever the phone’s current time zone changes. The Intent includes a time-zone extra that returns the ID of the new java. util.TimeZone
Android also uses Broadcast Intents to announce application-specific events, such as incoming SMS messages, changes in dock state, and battery level.