A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured. There are two ways to use broad cast receiver in android -- One is using dynamically in activity Second to register through manifest Using dynamically in activity Register broadcast receiver Via dynamically ( Run time ) // Create reciever object private BroadcastReceiver the_receiver = new PhoneCall(); // Set When broadcast event will fire. private IntentFilter filter = new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED); // Register new broadcast receiver this.registerReceiver(the_receiver, filter); // Reciever class which extends BroadcastReceiver public class PhoneCall extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { // Phone call state change then this method will au...
A blog where you can find all codes for Android, Corona, Basic tutorials, Interview questions and more...