One key point is to avoid over-using the processor. For example it's bad
practice to have code that runs in a loop polling for changes, much better
if possible to be able to block your thread on a wait handle so that it does
not consume unnecessary processor cycles. Another example is to avoid
running code when your app is in the background. For example if you do a lot
of custom drawing make sure your drawing code stops if your app isn't
visible otherwise you are wasting processor cycles on something the user
can't see.
You should also respect the users power settings, don't force the backlight
to stay on longer than is necessary (although it is possible to do this e.g.
if you wanted to show a video etc)
Other power considerations are more general to the device itself, if you are
running an enterprise app which is designed to be the only application on
the system then you may be in a position to control these, but if your app
runs alongside others on the device you should enable/disable hardware which
other software may need. For example the Backlight, Wifi, Bluetooth and the
phone hardware could be disabled if not required for a length of time.
Finally though not directly a battery preserving tip, but related to power
management, you should make sure your application behaves well if the device
is suspended and that it resumes correctly afterwards. This may be an issue
if you have file handles and sockets open.
Peter
--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com |
http://www.peterfoot.net |
http://www.opennetcf.org
Is there a book or website that offer tips on preserving battery life in
application design/programming in the compact framework?
Thanks,
Yosh