HTC 自动启动行为
我的 HTC Desire、Android 2.2 和 2.3、Vodafone 品牌遇到一个奇怪的问题。我的应用程序由多项活动和一项粘性服务组成。该服务代表主要活动启动。为了允许自动启动,我遵循通常的自动启动模式(根据 BOOT_COMPLETED
广播进行操作)。
现在 HTC 上的情况如下:系统启动后,应用程序收到广播并决定不自动启动。几秒钟后,应用程序正常启动,尽管不是我启动了这个野兽。仅当应用程序在上次关机阶段处于活动状态时才会发生这种情况。
因此,我的自动启动设置无法识别,HTC 似乎会启动任何具有粘性服务的应用程序,该服务在断电时处于活动状态。我已经用“音乐”应用程序仔细检查过它。启动它,检查正在运行的服务(您会找到它),重新启动,它将再次处于活动状态。停止它,重新启动,它就关闭了。
有人可以确认吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
HTC 有一个“即时启动”功能,似乎只是将活动的应用程序存储在文件中,然后将它们带回内存。事实上,这并不是真正的重启。它更像是 Windows 的休眠功能。因此,请检查在“设置 -> ”中禁用“快速启动”时是否会出现该行为。电源(或在应用程序下,取决于 Android 版本)。还要确认重新启动(而不是关闭/打开电源)实际上会发送 BOOT_COMPLETED。
不幸的是,如果问题是由于快速启动引起的,则没有机会获得 BOOT_COMPLETED。
PS 事实证明,确实可以实现快速启动。请参阅: android 注册永久广播接收器
它是与
<动作 android:name="android.intent.action.QUICKBOOT_POWERON" />
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" />