The documentation states that alarms are not persisted across reboots,
so that's something that has to be dealt with by your app. But here's
the gotcha that I can't find documented anywhere...

It seems that uninstalling the app also clears all set alarms for the
package being uninstalled. This means that anytime a user pulls down
an upgrade for your app, the app loses any set alarms. This could be
dealt with in a straightforward manner also, except that the api
doesn't tell you when your app is about to be uninstalled, or when it
has just been installed (am I correct here that ACTION_PACKAGE_*
broadcast actions don't work for the app being operated on?).

I worked around this by putting a build timestamp in the build and in
the shared preferences (since these persist across upgrades), then
checking this every time my package is started, thus detecting an
upgrade.

It would be nice though if a) we could have api support for detecting
'first run'/upgrade scenarios, and b) if the AlarmManager could
robustly persist alarms.

On Feb 16, 9:30 am, Dianne Hackborn <[email protected]> wrote:
> You can't expand the size of the log.  You can however use "adb shell
> dumpsys alarm" to see the current state of the alarm manager, which might
> help.
>
> On Sun, Feb 15, 2009 at 9:18 AM, Mariano Kamp <[email protected]>wrote:
>
>
>
> > Nope, not until somebody broke into my house and rebooted it during my
> > sleep ;-)
>
> > The other problem in finding the source of my issue is, that I can't go
> > back very long in the Android log files. My logfile tells me that the alarms
> > weren't fired, but the logfile doesn't contain any more information to
> > correlate that ;-(
>
> > Any idea how to expand the logfile, like to 12 hours?
>
> > On Sun, Feb 15, 2009 at 6:12 PM, Miguel Paraz <[email protected]> wrote:
>
> >> On Feb 15, 6:29 am, Mariano Kamp <[email protected]> wrote:
> >> >   This question is a bit strange, but does anybody know about a common
> >> > gotcha when using the AlarmManager? And not knowing it sometimes leads
> >> > to the AlarmManger forgetting alarms?
>
> >> >   I have a repeating task that runs once an hour. Some nights it runs
> >> > without a hitch and some nights it runs a couple of times and then it
> >> > isn't.
>
> >> Is it because your device is fully powered off and restarted?
>
> >> I think we need to wait for a "PIM" type API for have long-term
> >> persisting alarms.
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
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