ACTION_BOOT_COMPLETED 是粘性广播吗?
文档没有说其中一种方式,但我无法想象你为什么不让它坚持下去。
当 SD 卡不存在时,我的应用程序将进入暂停模式 - 但是,如果用户在系统完成启动之前启动我的应用程序,它将进入暂停模式。所以我希望它能够检测系统是否尚未完成启动并相应地等待几秒钟。
但如果您的应用程序必须已经运行才能听到 ACTION_BOOT_COMPLETED 广播,那么它就变得没有实际意义了。
The docs do not say one way or the other, but I can't imagine why you wouldn't let that stick.
My application goes into a paused mode when the SD card is not present- however if the user launches my application before the system is done booting, it goes into pause mode. So I'd like it to detect if the system has yet to finish booting and wait a few seconds accordingly.
But it becomes a moot point if your application has to already be running to hear ACTION_BOOT_COMPLETED broadcasts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
话虽这么说,根据源代码,它不具有粘性。
这怎么可能?
不,事实并非如此。事实上,获取
ACTION_BOOT_COMPLETED
广播的唯一方法是通过清单注册的BroadcastReceiver
,特别是因为您不能假设您的任何代码都会在广播时执行。That being said, according to the source code, it is not sticky.
How is that possible?
No, it does not. In fact, the only way to get
ACTION_BOOT_COMPLETED
broadcasts is via a manifest-registeredBroadcastReceiver
, specifically because you cannot assume that any of your code will be executing at the time of the broadcast.