RECEIVE_BOOT_COMPLETED not sent after power off? (works on restart)

1342 views
Skip to first unread message

Yorgos X

unread,
Feb 4, 2011, 5:08:26 AM2/4/11
to android-d...@googlegroups.com
Hi,

I am using a receiver to handle the receipt of the BOOT_COMPLETED action. It works well when I am restarting my phone (an HTC Desire HD) but not when I use power off and then start it up. The receiver is never called and it seems as if the BOOT_COMPLETED action is never sent. I also noticed that some other services that run on boot don't run as well after powering off and starting up again. I have noticed that some handsets don't provide both the power off and restart functionality.

Any ideas?

thanks in advance!

Yorgos

Marcin Orlowski

unread,
Feb 4, 2011, 5:51:53 AM2/4/11
to android-d...@googlegroups.com

Custom ROM by any chance?

Yorgos X

unread,
Feb 4, 2011, 5:54:29 AM2/4/11
to android-d...@googlegroups.com
nope, not even rooted or anything. just a phone off a shop shelf, untouched :)


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-d...@googlegroups.com
To unsubscribe from this group, send email to
android-develop...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Kostya Vasilyev

unread,
Feb 4, 2011, 5:56:32 AM2/4/11
to android-d...@googlegroups.com

Is the app installed on the memory card?

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

04.02.2011 13:55 пользователь "Yorgos X" <yor...@gmail.com> написал:

Yorgos X

unread,
Feb 4, 2011, 6:06:41 AM2/4/11
to android-d...@googlegroups.com
well, i run it from eclipse to install it and then restart and power off the phone to test if it works. Are the apps run straight from eclipse stored on the SD card? i don't know about that to be honest. I haven't done that explicitly though

2011/2/4 Kostya Vasilyev <kman...@gmail.com>

Marcin Orlowski

unread,
Feb 4, 2011, 6:07:00 AM2/4/11
to android-d...@googlegroups.com
On 4 February 2011 11:54, Yorgos X <yor...@gmail.com> wrote:
> nope, not even rooted or anything. just a phone off a shop shelf, untouched
> :)

Then it shall just work as it does here. Checked device logs? Also if
you rely on that broadcars make sure your app prevents SD card
installation as SD card is not mounted when that broadcast gets
propagated so your app won't it.

Marcin Orlowski

unread,
Feb 4, 2011, 6:09:45 AM2/4/11
to android-d...@googlegroups.com
2011/2/4 Yorgos X <yor...@gmail.com>:

> well, i run it from eclipse to install it and then restart and power off the
> phone to test if it works. Are the apps run straight from eclipse stored on
> the SD card? i don't know about that to be honest. I haven't done that
> explicitly though

No, they are run from internal memory, so that shall be fine.

Yorgos X

unread,
Feb 4, 2011, 6:10:16 AM2/4/11
to android-d...@googlegroups.com
I basically start an activity which is the main activity of my app on startup (I want the app to appear straight when you turn on the phone). So my main activity is declared as launcher in the manifest and in my receiver class I start an intent that launches it as well:

.....
        <activity android:name=".MainActivity"
                android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>      
        <receiver android:name=".MyIntentReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <category android:name="android.intent.category.HOME" />
            </intent-filter>
        </receiver>
    </application>

2011/2/4 Yorgos X <yor...@gmail.com>

Marcin Orlowski

unread,
Feb 4, 2011, 6:13:46 AM2/4/11
to android-d...@googlegroups.com
2011/2/4 Yorgos X <yor...@gmail.com>:

> I basically start an activity which is the main activity of my app on
> startup (I want the app to appear straight when you turn on the phone). So
> my main activity is declared as launcher in the manifest and in my receiver
> class I start an intent that launches it as well:
>
> .....
>         <activity android:name=".MainActivity"
>                 android:label="@string/app_name">
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>         </activity>
>         <receiver android:name=".MyIntentReceiver">
>             <intent-filter>
>                 <action android:name="android.intent.action.BOOT_COMPLETED"
> />
>                 <category android:name="android.intent.category.HOME" />
>             </intent-filter>
>         </receiver>
>     </application>

remove category from boot filter

Yorgos X

unread,
Feb 4, 2011, 6:15:44 AM2/4/11
to android-d...@googlegroups.com
yeah, i have checked the logs and thre is no indication of the app starting or the action boot_completed received. the sd is not mounted neither when the app is installed or at anytime during the testing process. As I've said before, on other devices that only provide "power off" functionality and not bot power off and restart, when I power off and then start up again, the action is received normally. On my phone it works well on restarting but not when powering off and then starting.

Yorgos X

unread,
Feb 4, 2011, 6:31:40 AM2/4/11
to android-d...@googlegroups.com
Mysteriously enough (new phone, haven't explored it much), a setting was preset to fast boot the device (is called "Fast boot - turn off to use some Market apps") and this apparently causes the device to start after a power off without sending the BOOT_COMPLETED action. Can any of you test this on their devices to confirm it is happenning for a fact? I unchecked this setting and my receiver works on both power off/startup and restart.

Marcin Orlowski

unread,
Feb 4, 2011, 6:54:48 AM2/4/11
to android-d...@googlegroups.com
On 4 February 2011 12:31, Yorgos X <yor...@gmail.com> wrote:
> Mysteriously enough (new phone, haven't explored it much), a setting was
> preset to fast boot the device (is called "Fast boot - turn off to use some
> Market apps") and this apparently causes the device to start after a power
> off without sending the BOOT_COMPLETED action. Can any of you test this on
> their devices to confirm it is happenning for a fact? I unchecked this
> setting and my receiver works on both power off/startup and restart.

That would be really silly "feature". What device is it?

Yorgos X

unread,
Feb 4, 2011, 7:06:29 AM2/4/11
to android-d...@googlegroups.com
HTC Desire HD


--

Mark Murphy

unread,
Feb 4, 2011, 8:30:30 AM2/4/11
to android-d...@googlegroups.com
Egad.

Can you tell me where in the Settings app (or elsewhere) this checkbox resides?

Thanks!

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

Yorgos X

unread,
Feb 4, 2011, 9:04:23 AM2/4/11
to android-d...@googlegroups.com
it is in menu -> settings -> applications

there are the five below options there:
- unknown sources
- manage applications
- running services
- development
- fast boot

Dianne Hackborn

unread,
Feb 6, 2011, 1:55:46 PM2/6/11
to android-d...@googlegroups.com
Wait, let's back up a second.

If their fast boot facility works how I assumed it does, it would actually be correct for it to not send boot_completed.

That is, if what this does is save the current device state and RAM to storage, and reload that when turning on, then it absolutely should not send boot_completed because it is actually coming back up into the same running state it had before.

So before going further with this, please check to verify there is actually a problem here: when you turn off and then back on, is the device state actually being reset?  Are your recent tasks lost?  Are registered alarms lost?  Are services that were started no longer started?

There would be a *lot* that is very broken if boot_completed wasn't actually sent as part of a fresh boot.
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Lance Nanek

unread,
Feb 6, 2011, 4:14:51 PM2/6/11
to Android Developers
I actually did meet a developer at an Android meetup the other day who
swore he didn't need to reset his alarms on boot up on a certain
phone...now I can ask if this option is involved next time I see him.

On Feb 6, 1:55 pm, Dianne Hackborn <hack...@android.com> wrote:
> Wait, let's back up a second.
>
> If their fast boot facility works how I assumed it does, it would actually
> be correct for it to not send boot_completed.
>
> That is, if what this does is save the current device state and RAM to
> storage, and reload that when turning on, then it absolutely should not send
> boot_completed because it is actually coming back up into the same running
> state it had before.
>
> So before going further with this, please check to verify there is actually
> a problem here: when you turn off and then back on, is the device state
> actually being reset?  Are your recent tasks lost?  Are registered alarms
> lost?  Are services that were started no longer started?
>
> There would be a *lot* that is very broken if boot_completed wasn't actually
> sent as part of a fresh boot.
>
>
>
> On Fri, Feb 4, 2011 at 6:04 AM, Yorgos X <yor...@gmail.com> wrote:
> > it is in menu -> settings -> applications
>
> > there are the five below options there:
> > - unknown sources
> > - manage applications
> > - running services
> > - development
> > - fast boot
>
> > On Fri, Feb 4, 2011 at 3:30 PM, Mark Murphy <mmur...@commonsware.com>wrote:
>
> >> Egad.
>
> >> Can you tell me where in the Settings app (or elsewhere) this checkbox
> >> resides?
>
> >> Thanks!
>
> >> On Fri, Feb 4, 2011 at 7:06 AM, Yorgos X <yor...@gmail.com> wrote:
> >> > HTC Desire HD
>
> >> > On Fri, Feb 4, 2011 at 1:54 PM, Marcin Orlowski <
> >> webnet.andr...@gmail.com>
> hack...@android.com

Peter Sinnott

unread,
Feb 6, 2011, 5:06:05 PM2/6/11
to Android Developers
I think the newer HTC phones (Desire HD/Z) support hibernation of some
sort. I have a vague recollection of it being mentioned at a launch
event in London.

On Feb 4, 11:31 am, Yorgos X <yor...@gmail.com> wrote:
> Mysteriously enough (new phone, haven't explored it much), a setting was
> preset to fast boot the device (is called "Fast boot - turn off to use some
> Market apps") and this apparently causes the device to start after a power
> off without sending the BOOT_COMPLETED action. Can any of you test this on
> their devices to confirm it is happenning for a fact? I unchecked this
> setting and my receiver works on both power off/startup and restart.
>
> On Fri, Feb 4, 2011 at 1:15 PM, Yorgos X <yor...@gmail.com> wrote:
> > yeah, i have checked the logs and thre is no indication of the app starting
> > or the action boot_completed received. the sd is not mounted neither when
> > the app is installed or at anytime during the testing process. As I've said
> > before, on other devices that only provide "power off" functionality and not
> > bot power off and restart, when I power off and then start up again, the
> > action is received normally. On my phone it works well on restarting but not
> > when powering off and then starting.
>
> > On Fri, Feb 4, 2011 at 1:09 PM, Marcin Orlowski <webnet.andr...@gmail.com>wrote:
>
> >> 2011/2/4 Yorgos X <yor...@gmail.com>:
> >> > well, i run it from eclipse to install it and then restart and power off
> >> the
> >> > phone to test if it works. Are the apps run straight from eclipse stored
> >> on
> >> > the SD card? i don't know about that to be honest. I haven't done that
> >> > explicitly though
>
> >> No, they are run from internal memory, so that shall be fine.
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers" group.
> >> To post to this group, send email to android-d...@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> android-develop...@googlegroups.com<android-developers%2Bunsu...@googlegroups.com>

Kostya Vasilyev

unread,
Feb 6, 2011, 5:18:52 PM2/6/11
to android-d...@googlegroups.com

If it really is hibernation (as opposed to a reboot), then alarms *should* persist, and there should be no need to reset them. Anyone have one of those and willing to check?

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

07.02.2011 1:07 пользователь "Peter Sinnott" <psin...@gmail.com> написал:

kaciula

unread,
Dec 20, 2012, 7:43:15 AM12/20/12
to android-d...@googlegroups.com
I have a similar issue. My users on Samsung Galaxy S 3 report that after reboot, my app's alarms don't work anymore.

On my nexus one and other tested devices, everything works OK after reboot.

What would be the solution for this?

>> >> For more options, visit this group at
>> >>http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-d...@googlegroups.com
> To unsubscribe from this group, send email to

Piren

unread,
Dec 20, 2012, 10:22:53 AM12/20/12
to android-d...@googlegroups.com
add this to your boot receiver filter
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
Reply all
Reply to author
Forward
0 new messages