0% found this document useful (0 votes)
15 views1 page

Android Tutorial 66

The document describes how to implement a BroadcastReceiver in an Android application to intercept the BOOT_COMPLETED event. It includes a code snippet for defining the receiver and a list of important system-generated events with their descriptions. Key events include battery status updates and boot completion notifications.

Uploaded by

alexandre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Android Tutorial 66

The document describes how to implement a BroadcastReceiver in an Android application to intercept the BOOT_COMPLETED event. It includes a code snippet for defining the receiver and a list of important system-generated events with their descriptions. Key events include battery status updates and boot completion notifications.

Uploaded by

alexandre
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Android

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<receiver android:name="MyReceiver">
<intent-filter>
<action android:name="[Link].BOOT_COMPLETED">
</action>
</intent-filter>
</receiver>

</application>

Now whenever your Android device gets booted, it will be intercepted by


BroadcastReceiver MyReceiver and implemented logic inside onReceive() will be
executed.

There are several system generated events defined as final static fields in
the Intent class. The following table lists a few important system events.

Event Constant Description

[Link].BATTERY_CHANGED Sticky broadcast containing the


charging state, level, and other
information about the battery.

[Link].BATTERY_LOW Indicates low battery condition on


the device.

[Link].BATTERY_OKAY Indicates the battery is now okay


after being low.

[Link].BOOT_COMPLETED This is broadcast once, after the


system has finished booting.

[Link].BUG_REPORT Show activity for reporting a bug.

[Link] Perform a call to someone specified

50

You might also like