On Fri, Feb 25, 2011 at 11:07 AM, Matt Quigley <[email protected]>wrote:
> 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? > AFAIK, your alarms are wiped, it will not start at noon. > On the other hand, if the AlarmManager DOES remove all the > scheduled events, how is your application supposed to restart the services? > On startup of your main app. Or catching one of the package updated broadcasts. I believe I saw a thread a while back (couldn't find it, sorry) where someone had this same issue and was able to use this broadcast to know when their app was updated and it was time to reset the alarms. > 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. > It doesn't matter. Assume it's been wiped and reschedule your alarms - matching PendingIntents will overwrite anything already set. > 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. > No, but you can check if you app has been updated (simple setting you can keep and check against) and if so reschedule your alarms, to be safe. > 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. > Yeah, no, don't even try that. > Does anyone have any advice on how to reliably keep a service scheduled > consistently after an application update? > Try the package updated broadcast. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- 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

