free web page counters

Windows Mobile Pocket PC Smartphone Programming

==>Click here for the SiteMap<==. Original contents with decent amount of source codes.

Wednesday, October 12, 2005

Pocket PC Power Management Series 2: Problem Domain

====>SiteMap of this Blog<===

Pocket PC Power Management Series 2: Problem Domain

Most UI-intensive applications require the user to interact via a screen UI using stylus or keyboard. For such applications, it does not make sense to run it when the device is suspended, or “in sleep mode”. What a developer needs to do is to avoid burning any CPU cycles when the device is sleeping or, to be more exactly, when the user is not interacting with the application (for example, its main window is not the foreground window.) Mike Calligaro from Microsoft Windows Mobile Team has two excellent articles on this topic with good examples. I strongly recommend readers to go over those two posts:

The problem we are trying to solve here belongs to another domain: What if the application needs to run continuously, or at least, needs to run periodically independent of the user’s action? It runs if the user puts the device unattended, it runs if the user sometimes powers the device on and turns it off quickly, and it runs when the device is put into a charger (of course).

A media player or a MP3 player is a great example of applications that needs to run continuously. A stock-alert application is a good example of applications that needs to run periodically.

Thinking about a stock-alert program that needs to constantly (if not continuously) monitor a stock symbol and alerts the user if the price is higher (or lower) than a predefined threshold value. Such program is a piece of cake in desktop windows, where you may simply write a monitoring thread and assume the thread can run all the time and continuously read stock price from a public server. The same piece of cake becomes sour if running in Pocket PC devices, since the monitoring thread might not get a chance to run for a long time, and you may miss an alert!

Keep in mind battery is precious in a handheld device, so you need to strike a balance between two conflicting factors: to make the system run thus consuming batteries vs. to save battery for the device. The general principle is still the same: to consume CPU cycles as less as possible.
  • If the application needs to run unattended, turn off the screen display by all means.
  • If the application does not need to run continuously, make it run periodically.
  • If the application does not need to run periodically, but needs to catch user’s stylus action as quickly as possible once the device is switched on, listen to a Wakeup event.

Category: [Power Management]

====>SiteMap of this Blog<===