Message delivery in Android, detailed broadcast mechanism

Source: Internet
Author: User

Introduction to the-------------------------------------- broadcasting mechanism ---------------------------------------------

The broadcast mechanism in Android is very flexible, and every application in Android can register its own broadcasts of interest, and the program will only receive the broadcast content that it cares about, which may come from the system or from other applications.

Android provides a complete set of APIs that allow applications to freely send and receive broadcasts.

Broadcast in Android can be divided into two types, standard broadcast and ordered broadcast.

standard Broadcast (normal broadcasts): standard broadcast is a fully asynchronous broadcast that, after broadcast, all broadcast receivers receive this broadcast message almost at the same time. This broadcast is more efficient, but it also means that it cannot be truncated.

ordered broadcast (Ordered broadcasts): ordered broadcast is a synchronous broadcast, after the broadcast, only one broadcast receiver will be able to receive this broadcast message at the same time, and when the logic in this broadcast receiver is completed, the broadcast will continue to pass.

------------------------------------- receive system broadcast -----------------------------------------

Android has built-in system-level broadcasts that allow you to listen to these broadcasts in your application to get status information for various systems.

When the phone is turned on, a broadcast will be issued, the battery will be issued a radio, the change of time will be issued a broadcast ... If you want to receive these broadcasts, you need to use a broadcast receiver.

Broadcast receivers are free to register their own broadcasts of interest, and when a corresponding broadcast is issued, the broadcast receiver is able to receive the broadcast and process the corresponding logic internally.

There are generally two ways of registering a broadcast, registering it in code and registering it in Androidmanifest.xml, which is called dynamic registration, which is called static registration.

Original address: http://www.cnblogs.com/woider/p/5126109.html

Message delivery in Android, detailed broadcast mechanism

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.