ACTION_BOOT_COMPLETED 是粘性广播吗?

发布于 2024-11-02 11:17:49 字数 323 浏览 1 评论 0原文

文档没有说其中一种方式,但我无法想象你为什么不让它坚持下去。

当 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懷念過去 2024-11-09 11:17:49

我无法想象你为什么不坚持下去。

话虽这么说,根据源代码,它不具有粘性。

但是,如果用户在系统完成启动之前启动我的应用程序,它将进入暂停模式

这怎么可能?

但是,如果您的应用程序必须已经运行才能听到 ACTION_BOOT_COMPLETED 广播,那么它就变得没有实际意义了。

不,事实并非如此。事实上,获取 ACTION_BOOT_COMPLETED 广播的唯一方法是通过清单注册的 BroadcastReceiver,特别是因为您不能假设您的任何代码都会在广播时执行。

I can't imagine why you wouldn't let that stick.

That being said, according to the source code, it is not sticky.

however if the user launches my application before the system is done booting, it goes into pause mode

How is that possible?

But it becomes a moot point if your application has to already be running to hear ACTION_BOOT_COMPLETED broadcasts.

No, it does not. In fact, the only way to get ACTION_BOOT_COMPLETED broadcasts is via a manifest-registered BroadcastReceiver, specifically because you cannot assume that any of your code will be executing at the time of the broadcast.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文