Boot Receiver not working

If you have HTC device you also need to register for "android.intent.action.QUICKBOOT_POWERON". So the entry in manifest should be:

    <receiver android:name=".OnBootReceiver"> 
        <intent-filter> 
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.QUICKBOOT_POWERON" />
        </intent-filter> 
    </receiver>    

On my HTC, if I turn off the device and turn it on for a while I got QUICKBOOT_POWERON and no BOOT_COMPLETED.

If I turn off the device and remove the battery for a while - I got BOOT_COMPLETED after start.


Also know that in Android >= 3.1 the app gets installed in 'stopped' state and will not get boot and shutdown events until the user 'does something' with the app at least once. See this post on the topic.


Put permission

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