>From a user experience point of view, I wouldn't suggest turning the screen
off during a long computation. Remember that a CPU running flat out doing
computation will use enough power that keeping the screen on won't have that
big an effect on battery life. Normally, the CPU is dozing most of the time,
making the screen a big fraction of total battery drain during the time the
device is "on".

On the other hand, you could use the alarm manager to be silently notified
periodically. Each notification would be your time to do a small fraction of
the total computation job. When the job is done, you could use the new Palm
OS 4.0 attention manager (or the alarm manager is earlier OS versions) to
let the user know that the computation is complete. The alarm manager
normally turns the screen on, but if you use procedural alarms rather than
launch codes, the screen is left off. Be warned that a crash during this
time won't turn the screen on, resulting in what appears to be a dead Palm.
Pretty scary for the user, so be careful! Test your code with the screen on
(use EvtResetAutoOffTimer). The other obstacle you'll have to overcome is
that procedural alarms require you to pass the address of a routine in your
application to the alarm manager. This means the code had better still be
around, and still in the same place, when the alarm fires. To make sure this
is true, you need to lock the code segment in which the routine resides, and
you need to protect it so it doesn't get deleted. In Palm OS 4.0, it's
possible to do this while allowing the user to delete the application, using
a notification to cancel the alarm before the app goes away. This definitely
isn't an easy thing to do, but it can be done.
-- 
Peter Epstein

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

Reply via email to