Course objectives:
Measure the test taker's understanding about the android message mechanism.
Master two types of broadcast messages
Master broadcastreceiver's message receiving programming
Key and difficulties:
Sendorderedbroadcast ()
Assessment objectives:
What are the two Broadcast types sent in Android? And their differences?
What should I do when writing broadcastreciever?
I. What is the function of broadcast reveiver and why?
Used to receive system and custom messages.
Notify and determine the execution status in the system
1. system execution status: The system is started, the TF card is plugged in and out, the system is ready to shut down, the power is low, and the MSMQ.
2. Custom execution status: the message sending prompt update interface.
Ii. What messages does broadcast receiver receive?
Regular message (normal broadcasts), sent through context. sendbroadcast
Ordered messages (ordered broadcasts) are sent through context. sendorderedbroadcast
3. FAQ: What are the differences between the two types of messages?
4. How to Use
Inherits the broadcastreceiver class.
Reload the onreceive () method.
Configure <reciever> and <uses-Permission> In androidmanifest. xml.
5. How to enable the service when the system starts?
Android system in manifest. permission has such a definition of receive_boot_completed. When your program has this permission, you can receive a system broadcast after the system is started. The broadcast flag is action_boot_completed, therefore, we only need to define a broadcastreceiver to receive the broadcast and add a custom action.
6. FAQ: Thoughts on the life cycle of the host process received by broadcastreceiver
9. Four major components-broadcast Receiver