The difference between dynamic broadcasting and static broadcasting

Source: Internet
Author: User
  • lifetime: The lifetime of a static broadcast can be much longer than a dynamic broadcast, because many of the static broadcasts are used to monitor the system time, for example, we can monitor the phone boot. Dynamic broadcasts terminate with the end of the context
  • Priority: dynamic broadcast has higher priority than static broadcast
  • Registration: Dynamic Broadcasting does not need to be declared in Androidmanifest.xml to be used directly (register with receiver), that is, dynamic, while static broadcasting is required, and sometimes in androidmanifest.xml, to add some permission declarations. Static registration is when the program is closed, if there is a broadcast sent, you can also start the program. The lifecycle of a dynamic registration is the same as the life cycle of a program, and a broadcast that is dynamically registered after a program is closed is not able to receive a broadcast
  • Advantages of Dynamic registration: in the Android broadcast mechanism, the priority of dynamic registration is higher than the priority of static registration, so we need to dynamically register the broadcast receiver if necessary.
  • the advantage of static registration: The dynamic registration of the broadcast receiver also has the advantage that when the activity used to register the broadcast is closed, the broadcast fails, and also reflects the advantage of statically registered broadcasts, that there is no need to worry about whether the broadcast receiver is turned off, as long as the device is turned on, Broadcast receivers can be received.

The difference between dynamic broadcasting and static broadcasting

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.