Android BOOT_COMPLETED not received when application is closed

Starting with Android 3.1 all applications, upon installation, are placed in a "stopped" state.(This is the same state that the application ends up in after the user force-stops the app from the Settings application.)

Android stopped state

While in "stopped" state, the application will not run for any reason, except by a manual launch of an activity. (Meaning no BroadcastReceviers(ACTION_PACKAGE_INSTALLED, BOOT_COMPLETED etc.) will be invoked, regardless of the event for which they have registered, until the user runs the app manually.)

This is an anti-malware move by Google. Google has advocated that users should launch an activity from the launcher first, before that application can go do much. Preventing BOOT_COMPLETED from being delivered until the activity is launched is a logical consequence of the that argument.

More details about this:
http://developer.android.com/about/versions/android-3.1.html#launchcontrols
http://commonsware.com/blog/2011/07/05/boot-completed-regression.html
http://devmaze.wordpress.com/2011/12/05/activating-applications/


Each answer here add a small piece of information, so here is the summary of it all:

To make sure you will receive the BOOT_COMPLETED make sure you do the following:

  1. Add your receiver to manifest (don't forget the flags):

    <receiver android:name="com.yourpacakge.BootReceiver" android:exported="true" android:enabled="true">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </receiver>
    
  2. Add permission:

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

  3. After installing your app, it needs to be lunch at least once, manually by the user, in order to receive Boot complete event.(More details)


I start my app when the BOOT_COMPLETED, so I know it's working. I add Log.d it won't show. I add Toast it show. Small differents in Manifest.xml

<receiver android:name="com.example.startuptest.StartUpBootReceiver">
    <intent-filter>
         <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>            
</receiver>

was struggling with the same problem, the reason is you are using Log.d to track you application in logcat, unfortunately when you restart your phone the application is receiving the BOOT_Complete but you can't see it because it's not logging to logcat.

try making a Toast with some text instead of Log.d to make sure if BOOT_COMPLETED is or is not received.

hope this Help.