Android January 22, 2014

Source: Internet
Author: User

I. Broadcasting priority ORDER

There are two important elements of Android broadcast:

1 broadcast -for sending broadcasts

Orderly broadcast-received by the broadcast receiver, can be terminated , unable to continue to communicate. Typical representative: SMS Broadcast

Normal broadcast-a broadcast receiver that is sent to each registered (subscribed), cannot be terminated. Typical representative: Start-up broadcast

2 broadcast receivers -to receive broadcasts after a subscription to a broadcast

Static registered broadcast-set in Androidmanifest.xml, the program does not need to start and can receive. Typical representative: A lot of start-up apps, are receiving start-up broadcast with the service.

Dynamic registration of broadcasts-broadcasts are registered in the code and cannot be received when the program is not started. Typical representative: Go SMS, will be forced to stop the go SMS, go SMS can not receive text messages.

 Broadcast registration process

Receive broadcast sequence process

In the Activitymanagerservice processing broadcast, when broadcast is an orderly broadcast, the dynamic broadcast receiver and the dynamic broadcast receiver are combined to form the final order of sequential broadcast reception. The above-mentioned Rule 1 SortingFor:1 Priority-high receive first2 static and dynamic broadcast receivers with precedence over3 A dynamic broadcast receiver of the same priority or a static broadcast receiver of the same priority, in the order in which the process is registered in Figure 1. that is, static: First scan is larger than after scanning, dynamic: first registered greater than after registration. When broadcasting is a normal broadcast, Rule 2 Sortingis: 1 ignores priority, the dynamic broadcast receiver takes precedence over the static broadcast receiver 2 Rule 1 SortingThe 3rd two. Basic Questions and Answers who controls the life cycle of the activity? Answer: who is manipulating this unreliable application stack behind the scenes? Answer: Why are "programs unresponsive" always popping up sudden and where do they come from? Why do I have to keep sensitive data in OnPause? Damn binder, under the Black Veil, are you a man or a woman? who killed my Service and how can I survive? what happens to the threads that are still running after the activity is destroyed? when you press the back key, will you be sure to return to the main screen? Some people say Looper and Handler, a process can only have a looper is positive?

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.