[Development Diary of Android in a row from scratch] (6) -- Broadcast aggreger and androidaggreger of four Android Components
Broadcast receivers exist as system listeners. They can listen to events in the system or other applications in the system to respond. For example, when the device is started, the application must check the data changes. In this case, the message can be broadcast to notify the user. When the network status changes, users can be notified through broadcast when the power usage changes. To be a metaphor, broadcast is like our senses, which can effectively and quickly obtain information from the outside to feedback to ourselves.I. functions and features of Broadcast
2. Broadcast event listening Methods
There are two methods to use broadcast for event listening: static registration and dynamic registration, or cold plugging and hot swapping. Static registration is to write information about the broadcast receiver in the application configuration file. When a broadcast event occurs, the Component Management Service obtains information about the broadcast components of the installed application from the installation package management service. Dynamic Registration uses Context. registerReceiver and Context. unregisterRecever to dynamically bind the broadcast receiver to the event to be monitored.
3. Two types of Broadcast
4. Broadcasting of all kinds
There are many built-in intent. action in android. By listening to these events, we can accomplish many functions.
Broadcast is easy to use and contains very little content. At most, you must remember several common actions in the system. However, application development combined with broadcast will bring a better user experience. The use of broadcast will make users feel that developers can take various situations into account for users, this can often retain most users. So consider the occurrence of various situations and do not mean to use the broadcast, so as to leave a good impression on the user. Download resources: demo = = Author: cpacm
(Http://www.cnblogs.com/cpacm/p/3916367.html)