Broadcast of Android

Source: Internet
Author: User

Broadcast is divided into two different types: normal broadcast (normal broadcasts) and ordered broadcast (ordered broadcasts )". The former is completely asynchronous, and all receivers (logically) run at the same time. This is a good practice for message transmission efficiency, but the disadvantage is: the receiver cannot pass the processing result to the next receiver, and cannot terminate the propagation of the broadcast intent; however, the latter executes the receiver one by one-the system will follow the priority level declared by the receiver (declared in the Android: Priority attribute of the intent-filter element, the higher the priority level, the value range: -1000 to 1000. You can also call setpriority () of the intentfilter object to set it) and execute it in sequence. Context. sendbroadcast ()
A normal broadcast is sent, and all subscribers have the opportunity to obtain and process it. Context. sendorderedbroadcast () sends an ordered broadcast. The system executes the receivers one by one based on the priority level stated by the receiver. The previous receiver has the right to terminate the broadcast (broadcastreceiver. abortbroadcast (), if the broadcast is terminated by the previous receiver, the subsequent receiver will no longer be able to obtain the broadcast. For ordered broadcast, the previous receiver can store the processing result in the broadcast intent and then pass it to the next receiver.

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.