BOOT_COMPLETED not called on Honeycomb after export
Asked Answered
U

1

4

I have a very weird problem, and none of the questions already on the website have an answer or the same problem.

I have an app that receives BOOT_COMPLETED. I made sure it could receive the intent by setting android:installLocation to internalOnly. I have a Log.Debug in my OnBoot class, confirming wether or not it was called.

I have two devices, an Android 2.2, and a Honeycomb. On android 2.2, it works fine, but Honeycomb...

  • If I install the application on the honeycomb tablet with eclipse's "run" button, onBoot is called when the tablet boots.

  • If I install the application on the honeycomb tablet after exporting the *.apk file, onBoot is never called.

  • If I install the application on the honeycomb tablet after exporting the *.apk file, AND manually start an activity before rebooting, onBoot is called.

It seems like the application needs its activity to be started at least once for the receiver to be registered... It doesn't feel right, since an app might have no activity, and the Froyo doesn't work that way...

Unanswerable answered 13/3, 2012 at 10:55 Comment(1)
Where do you have your broadcast receiver? Coded in Activity or included in manifest?Toole
M
9

This works as intended, assuming you are using android 3.1. and later.

Applications installed on 3.1 and later are in the stopped state after installation. They have to be explicitly started by the user at least once to get out of that.

Applications in stopped state don't receive any broadcast intents, including BOOT_COMPLETED.

See Android 3.1. - API Overview - Launch controls on stopped applications

Malda answered 13/3, 2012 at 11:8 Comment(3)
I wasn't aware of that, but I thought there was something I didn't know. Thanks a lot for your answer.Unanswerable
@alextsc Thanks for your answer. Does this new 3.1 logic only apply to third-party apps using the SDK, or also for an app that's signed with the platform key (or is there a way to go around it via a permission only available for the android.uid.system user)?Notice
@MathiasLin I don't know. I imagine there has to be some sort of exception for system apps, but that's just me guessing into the blue. I rarely work outside the normal SDK apps, so I never checked this direction.Malda

© 2022 - 2024 — McMap. All rights reserved.