当您的 BroadcastReceiver 通过 Intent 被调用时,它在哪个进程上运行?
我知道我们有 10 秒的时间来处理意图;否则,看门狗定时器将启动。它应该是一个轻量级功能。所以我的问题是,BroadcastReceiver 是否与您的根活动在同一进程中运行?或者它运行在Zygote系统进程上?
I know that we have 10 seconds to handle an intent; otherwise, watch dog timer will kick in. And its suppose be a light-weight function. So my question is, does the BroadcastReceiver run in the same process as your root activity? Or does it run on Zygote system process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。而且,正如 xandy 所说,它也在主应用程序线程上运行。您的
BroadcastReceiver
应该非常快速地完成其工作,或者在可以执行长时间运行工作的IntentService
(或其他东西)上调用startService()
一个后台线程。顺便说一句,我很高兴看到您现在不再忙于拯救世界,有时间花在 Android 应用程序开发上。花时间在自己的爱好上而不用担心被枪击、炸毁等,这一定很好。:-)
Yes. And, as xandy notes, it also runs on the main application thread. Your
BroadcastReceiver
should either do its work very quickly or callstartService()
on anIntentService
(or something) that can do long-running work on a background thread.BTW, I am pleased to see that you have time to spend on Android application development, now that you are no longer busy saving the world. It must be nice to spend time on a hobby and not worry about being shot at, blown up, etc. :-)