[Development Diary of Android in a row from scratch] (6) -- Broadcast aggreger and androidaggreger of four Android Components

Source: Internet
Author: User

[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)



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.