Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. These messages are sometimes called events or intents. For example, applications can also initiate broadcasts to let other applications know that some data has been downloaded to the device and is available for them to use, so this is broadcast receiver who will intercept this communication and will initiate appropriate action.
Appropriate action can change from one situation to another by programmer’s decision. Sometimes a Toast will be popped up, sometimes another broadcast and sometimes another Activity will be started.
This code snippet will probably get error like:
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Because of the context can come from anywhere. In order to make this code snippet functional, it should be changed in a way that:
This will work.