alkber
alkber

Reputation: 1436

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. 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 ?
  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

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. 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

Upvotes: 0

Views: 251

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

pending intents have a scope only in memory along as the android operating system is live ?

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.

Upvotes: 1

Related Questions