Hi,

I just tracked down a really hairy issue that made a lot of my users
think my app did nothing and made me really confused because I
couldn't recreate it on my phone.

In my onDestroy, an AlarmManager sets up a repeating alarm if a given
preference is set to true (defaults to true).  When the app is
installed for the first time, the onDestroy method is called.  Is this
expected?

I know that the onDestroy is called because I have a toast message
that shows when it is, and theoretically the AlarmManager is doing its
thing.  This causes some weird issue where the alarm and/or the
service it calls is "permanently" broken... until the app is
reinstalled.

This is why I didn't catch it until I tried really hard to look for it
using the emulator since I'd already tried several versions on my
phone and there was no way to put it back into the state where the
error would happen.  I'm now getting around this by checking another
preference variable and assuming it's an initial install if the pref
is null and immediately exiting out of the method.

Any ideas on why this is happening?  I don't see why the onDestroy is
called when the app is first installed, and I especially don't
understand why using the AlarmManager in onDestroy causes a basically
permanently broken state.

Regards,
Steve
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to