Joke Collection Website - Blessing messages - Broadcast (broadcast)
Broadcast (broadcast)
Broadcasting is divided into two aspects: broadcasting sender and broadcasting receiver. In the Android system, many operations will be sent after completion, such as sending text messages, making phone calls, turning on the phone, or changing the network status and power supply.
Broadcasting is divided into disorderly broadcasting (ordinary broadcasting) and orderly broadcasting.
This is a completely asynchronous and efficient broadcast. After broadcasting, all broadcast receivers may even receive broadcast messages at the same time, so there is no order between them. Unordered broadcasts cannot be intercepted, terminated or modified.
This is a synchronous broadcast. After the broadcast is sent out, only one broadcast receiver can receive the broadcast message at the same time, and the broadcast will continue to be delivered after the logic in this broadcast receiver is executed. There are a series of broadcast receivers. A broadcast receiver with high priority can receive the broadcast message first, and the previous broadcast receiver can also intercept the broadcast being transmitted, so that the latter broadcast receiver cannot receive the broadcast message.
Broadcast registration can be divided into static registration and dynamic registration.
Add it to the AndroidManifest.xml file.
broadcast receiver
Register the broadcast in onCreate () of Activity.
Unregister the broadcast in the active onDestroy ().
The life cycle of broadcasting is only about ten seconds. After this time, it will be reported to the application instead of the response (ANR). If you want to do a time-consuming operation, you should send your intention to the service and let it complete. Broadcast can't be solved by sub-thread, because the life cycle of BroadcastReceiver is short, and the broadcast may end before the sub-thread ends.
- Previous article:What is the telephone number of Changzhou Medical Insurance Bureau?
- Next article:Logical suffix &; The pronunciation and origin of
- Related articles
- How to apologize to your boyfriend
- How should a person who wants to join the army write to his girlfriend?
- A short Spring Festival greeting for the Year of Tiger 2022 A short New Year greeting for 2022
- Should the mobile phone be returned after the rent money is paid off?
- What is the voice verification code? How to use it?
- How to set up single card and double label for Xiaomi mobile phone
- How to turn on the photo function in SMS on iphone6?
- How does iphone clean up storage space?
- How to inquire about the repayment date of Guangfa Credit Card?
- Talk about happy birthday copywriting