Broadcast receiver is used to monitor the intent.
Android uses a lot of broadcast receiver, such as: Power on, call in, send messages, cell phone is too low
There are two ways of registering broadcast receiver.
1. Register in Code
2. Register in the manifest file
Receiver registered in this way is always active, even if the application shuts down
There is also a sticky broadcast, he is a variant of broadcast. This broadcast will save the value of the last broadcast, when a newly registered Boradcast receiver
You can get to the last value directly.
Typical application scenario: get battery changes.
If I were to recharge my phone now, the broadcast event had been sent out. Now I write a code to register the word receiver, if it is normal boradcast reveiver, because the broadcast has been sent out, we can not receive any information,
But with sticky broadcast, you can get the last message (the battery is now in the charging state)
Broadcast receiver for Android