简体   繁体   English

Android待处理的Intent行为和系统重启?

[英]Behavior of Android pending Intent and system restart?

This is regarding how robust is android with delivering pending intents to services when it has to deal with phone restart. 这关系到android在处理电话重启时向服务交付未决意图的能力。 I'm more worried about reliability of pending intents in the work queue. 我更担心工作队列中待定意图的可靠性。

  1. Am i right to assume that, pending intents have a scope only in memory along as the android operating system is live ? 我是否可以假设,待处理的意图仅在内存中具有范围,而android操作系统是实时的?
  2. Does pending intents have some amount of persistence to disk per app, during system restarts or shutdown, so that it is restored back ? 在系统重新启动或关闭期间,挂起的意图是否会对每个应用程序的磁盘具有一定程度的持久性,以便将其还原回?

If persistence of pending intents are absent, i'm not sure it is reliable enough use pending intents, if we have long running service with sub tasks to be executed. 如果没有待定意图的持久性,那么如果我们长期运行需要执行子任务的服务,我不确定使用待定意图是否足够可靠。

START_REDELIVER_INTENT START_REDELIVER_INTENT

If the system kills the service after onStartCommand() returns, recreate the service and call onStartCommand() with the last intent that was delivered to the service. 如果在onStartCommand()返回后系统终止了该服务,请重新创建该服务,并使用传递给该服务的最后一个意图调用onStartCommand()。 Any pending intents are delivered in turn. 任何待处理的意图都会依次传递。 This is suitable for services that are actively performing a job that should be immediately resumed, such as downloading a file 这适用于正在积极执行应立即恢复工作的服务,例如下载文件

pending intents have a scope only in memory along as the android operating system is live ? 待处理的意图仅在内存中具有作用域,而android操作系统是实时的吗?

Yes. 是。

Does pending intents have some amount of persistence to disk per app, during system restarts or shutdown, so that it is restored back ? 在系统重新启动或关闭期间,挂起的意图是否会对每个应用程序的磁盘具有一定程度的持久性,以便将其还原回?

No. If you need work to survive a reboot, you need a persistent work queue. 否。如果您需要进行重新启动后的工作,则需要一个持久的工作队列。 You might consider using Tape . 您可以考虑使用Tape

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM