MaChee Neraid MaChee Neraid - 1 year ago 62
Android Question

broadcastreceiver does not kick in after rebooting

Good day,

I am creating an app based on this.

BroadcastReceiver and alarmManager Android

it is running smoothly,

then I try to make it run even the client boot its phone by adding this.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<receiver android:name=".MyBroadcastReceiver" android:enabled="true">
<action android:name="android.intent.action.BOOT_COMPLETED" />

the problem is, broadcastreceiver is lost after reboot.

My BroadcastReceiver looks like this

public class MyBroadcastReceiver extends BroadcastReceiver{
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
Toast.makeText(context, "Don't panik but your time is up!!!!.",
// Vibrate the mobile phone
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);


This is already fix. Thanks. (for future reference) :)

Answer Source

Try to update to the following.

    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
            //Do your stuffs here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download