Hi,

  as far as I see scheduled alarms are lost when upgrading an application.
As this seems to be an un-install and re-install I can understand what.

  What is the best way to cope with that?

  When an application is upgraded it doesn't need to be launched by the
user, so it is not the most sensible approach to use the "onCreate" method
of the launcher activity. Is there any other life-cycle event I can tap
into?

  If that is not the case, then I would think a not-too-bad-way of handling
this is to hook into the onCreate method on my launch activity, an create a
PendingIntent with the NO_CREATE [1] flag and schedule it again with the
AlarmManager. That shouldn't result in any change to the existing schedule,
if it exists, and should create the schedule when the application is
installed for the first time or after an upgrade.

  It's not elegant, as it expects the user to open the app after upgrading.
It's not a major PITA today as the current Market expects the user to
upgrade each app by hand and it is not unlikely that the user starts it, but
for the future I would expect that the Market makes automatic mass-upgrades
possible.

  Also it is not too nice to handle this logic in the UI. Furthermore it
doesn't seem elegant to bother the AlarmManager with a new PendingIntent
every time the app is launched. Is there anyway to query the AlarmManager
for scheduled events, like with dumpsys alarm on the command line?

  Better ideas?

Cheers,
Mariano

[1]
http://developer.android.com/reference/android/app/PendingIntent.html#FLAG_NO_CREATE

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

Reply via email to