Broadcast Receivers 1. Registration method Dynamic Registration: Registration in the program, such as in the activity of the OnCreate () method registered static registration: Androidmanifest.xml Registration 2. What broadcast receive system messages can be received: such as network status changes, system completion startup, Battery status Receive app message: such as SMS call Notification 3. Use caution does not allow time-consuming operations in the OnReceive method, does not allow startup of new threads generally used to start other components, such as service, status bar notification send broadcast 1. Broadcast type by receive: Standard broadcast (default), Ordered broadcast by broadcast range: Global Broadcast (default), local broadcast 2. The sending method can be directly used in the activity Sendbroadcast (), Sendorderedbroadcast () Method 3. Sent what sent a Intent object OnCreate () {... public
void OnClick (View v) {
Intent Intent = new Intent ("com.example.b Roadcasttest. My_broadcast ");
Sendbroadcast (intent);
}...
} Therefore, data can be transmitted as a way of communicating openly between processes. 4. Standard broadcast one-to-many, receiver simultaneously receives 5. Ordered broadcast receivers can be interrupted (intercepted) using Abortbroadcast () in the receiver OnReceive () method, in accordance with the order of priority sequential delivery broadcasts Stop delivery Set priority in Androidmanifest.xml 6. Local broadcast using Localbroadcastmanager (singleton)
Sendbroadcast () method send broadcast using LOCALRECEIVER receive broadcast local broadcast can only be registered dynamically
The first line of code--android read the notes broadcast