






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







How to Create a Broadcast Receiver
Java Receiver public class MyReceiver extends BroadcastReceiver {
@Override public void onReceive(Context context, Intent intent) {
// this code runs once ☺ Toast.makeText(context, "Broadcast Received", Toast.LENGTH_LONG).show();
} }
Example Broadcasts
android.intent.action.ACTION_POWER_CONNECTED android.intent.action.ACTION_POWER_DISCONNECTED android.intent.action.ACTION_SHUTDOWN android.intent.action.AIRPLANE_MODE android.intent.action.BATTERY_CHANGED android.intent.action.BATTERY_LOW android.intent.action.BATTERY_OKAY android.intent.action.BOOT_COMPLETED android.intent.action.CAMERA_BUTTON