1

I have a strange problem with an HTC Desire, Android 2.2 and 2.3, Vodafone brand. My app consists of several activities and one sticky service. The service is launched on behalf of the main activity. In order to allow autostart, I'm following the usual autostart pattern (acting upon the BOOT_COMPLETED broadcast).

Now the situation on the HTC is as follows: After system boot the app is getting the broadcast and decides to NOT autostart. Several seconds later the app starts normally, although it isn't me, who launches the beast. This happens only if the app was active during the last power off phase.

So my autostart settings is not recognized, the HTC seems to launch any app with a sticky service, which is active on power down. I have double checked it with the "Music" app. Launch it, check in running services (you'll find it), reboot, it will be active again. Stop it, reboot, it is off.

Can somebody confirm?

decades
  • 827
  • 17
  • 25
  • Is your app being installed to the SD card? If so, then it's likely that the SD card has not been mounted by the time the BOOT_COMPLETED broadcast is sent, and therefore does not get woken as you are expecting it to. – Mark Allison Jun 16 '11 at 09:27
  • Hi Mark, no, it resides in the internal memory. – decades Jun 16 '11 at 09:32

1 Answers1

2

HTCs have an "instant on" feature which seems just to store active applications on a file and then bring them back to the memory. Which, in fact, is not actually a reboot. It's more like Windows' hibernate function. So, check if the behaviour occurs when disabling "Fast boot" in Settings -> Power (or under Applications, depends on the Android version). Also confirm that doing Restart (not power off/on) actually sends BOOT_COMPLETED. Unfortunately, if the issues is because of the fast boot stuff, there is no chance to get the BOOT_COMPLETED.

P.S. As it turns out it is, indeed possible to catch a fast boot. See: android register a permanent Broadcast Receiver

It is with <action android:name="android.intent.action.QUICKBOOT_POWERON" />

Community
  • 1
  • 1
Kamen
  • 3,575
  • 23
  • 35
  • Hi Kamen, exactly. I found that by myself yesterday after hours. The device seems to be off, but instead it is just in a deeper sleep. I have found this settings on a HTC Desire HD, but got the info from a customer using a "normal" HTC, that there is not such a setting (unverified). I will forward your "under applications" hint. Thanks... EDIT: Restart is sending BOOT_COMPLETED, but that doesn't help, because the app starts in any way, if it was on while restarting. This changes, if FAST BOOT is off. In this case the app follows the actions taken/not taken on BOOT_COMPLETED. – decades Jun 17 '11 at 20:23
  • Fast Boot is not available on all models. For sure HD has it and Wildfire does not :) So - again - depends on the model. On my Desire HD it changed where the option was placed from 2.2 to 2.3.3 upgrade – Kamen Jun 22 '11 at 09:26