Skip to content Skip to sidebar Skip to footer

Weird Boot_completed Behavior

I was expecting my app to load the BroadcastReceiver AutoStartOnBoot when I reboot my device. I uninstall and install the app. Which means that all existing settings are deleted.

Solution 1:

Edit:

From your First two Points

1.I uninstall and install the app. Which means that all existing settings are deleted. I then power down the phone. And power it back up, the Broadcast receiver is never called.
2.I now, power down the device one more timeand power it up again. Yet, broadcast  receiver isnot called.

Why it is not working??

Here your just installed the app but not launched.In android after first launch only all your manifest data is registered and all receivers work.But in your third case its working because you are launched the app so here all receivers gets registered.

For more check here Broadcast Receiver not working immediately after package installation

You have to add this permission outside of the <application> tag in manifest file

instead of this

<android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >

Add this like

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

Solution 2:

The behavior that you describe is perfectly normal. Something needs to use an explicit Intent to start up one of your components before your manifest-registered receivers will work. Typically, that will be the user tapping on your home screen launcher icon.

See the Android 3.1 release notes for more about this.

Solution 3:

All answers are correct. This behavior is as per expectation. The app is inactive when installed, until its manually launched by the owner. Only after that is the BOOT_COMPLETED broadcast receiver registered to the OS.

Unless we put the app in the system folder, which keeps all apps in active state. We are device company, adb push your.apk /system/app is possible for us.

Some interesting links, here and here

Post a Comment for "Weird Boot_completed Behavior"