Search code examples
androidbroadcastreceiverbootcompleted

How can I discover that my device has rebooted, given that HONEYCOMB BOOT COMPLETED is no longer supported?


I am developing app in Android 4.0.3. I've read that the HONEYCOMB BOOT COMPLETED event is no longer supported, according to Google's documentation.

Given this, how can I discover that my device has rebooted?

CODE -

Java Class :-

public class MyStartupIntentReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        Logger.i("Device", "REBOOT");
        Logger.i("Device", "REBOOT");
        Logger.i("Device", "REBOOT");
        Logger.i("Device", "REBOOT");
        Logger.i("Device", "REBOOT");
    }
}

Manifest File :-

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

<receiver android:name="MyStartupIntentReceiver" >
    <intent-filter>
       <action android:name="android.intent.action.BOOT_COMPLETED" />
       <category android:name="android.intent.category.HOME" />
    </intent-filter>
</receiver>

Solution

  • sorry , but perhaps you are wrong about the documentation , any way make sure that you are including <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> permission in your manifest . I use this broadcast in many apps and they works great.

    Make sure you know aslo about this info BOOT_COMPLETE is sent to applications before external storage is mounted. So if application is installed to external storage it won't receive BOOT_COMPLETE broadcast message.