Hi all.  I was wondering what would happen in the following scenario:

Your application schedules a service or any type of pending event on
the AlarmManager.  Let's say it repeats every 24 hours at noon.  If an
application update is available, and the user updates the application
at 10 AM through the Marketplace app, does that update remove all
scheduled events from the AlarmManager?  Or will the service still
start at noon?

I understand that there could be complications if the pending events
aren't removed: the application update could have completely removed
the service that would have been started.  But in that case, the
AlarmManager would just catch an exception when it tries to start the
service and ignore it.

On the other hand, if the AlarmManager DOES remove all the scheduled
events, how is your application supposed to restart the services?
1. You can't tell on the application startup whether or not your
previous services have been cancelled, because there is no way for
your application to query AlarmManager to see if your services are
still scheduled or not.
2. You can't blindly start your service at app startup, because you
don't want a service that is supposed to run every 24 hours to run 5
times a day if the user starts your app 5 times that day.
3. Even if you persist a flag to disk indicating that your service is
running, your application doesn't receive an event that the service
was stopped (that I know of), so you can't turn that flag off if the
service is cancelled during an application update.

Does anyone have any advice on how to reliably keep a service
scheduled consistently after an application update?
Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to