- 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