David, is there any suggestion on how to recognize correctly why the
device woke (user interaction, alarm or other reasons like being placed
in the cradle maybe) ?
I can't think of any direct ways, so you should probably find a combination of the heuristics which have been suggested in this thread.

One additional idea is to try calling KeyCurrentState() to see if there's a key down when you get the notification: if so, it is likely that's why the device awoke.

And register for various other notifications, like the "hotsync is about to start" one and the "a device was attached" (whatever they're called; look 'em up); if you get them soon enough after wakeup, you might safely bet that's why the device awoke. Indirect, but might well get you a pretty good level of certainty.

On the other hand, remember: "waking for an alarm" can mean various things in reality. The alarm might have been a meeting alarm set by the datebook, or an alarm set because some app has to do some housekeeping, or various other things only limited by developer imagination. Datebook-style alarms are only one reason to wake up with the Alarm Mgr mechanism.

-David Fedor
PalmSource, Inc.

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/


Reply via email to