Search Wiki:
Resource Page Description
One of the most compelling challenges every Mobile Device developer has to deal with is preserving battery life.

On this Code Gallery page you will find the accompanying sample code of the webcast titled 24 Hours of Windows Mobile Application Development: Developing Battery-Friendly Applications.

The first sample available in the downloadable Visual Studio 2008 solution shows you how you can make use of the Activated and Deactivate events on a Form to temporarily stop activity in your application. The sample application shows a running clock, that temporarily is paused when the application is in the background. You can easily run this application in a Device Emulator. Set a breakpoint on the t_Tick event handler and verify that the debugger will not break as long as the application is in the background.

The second sample makes use of PowerManager to request a particular power need. This application makes use of functionality of OpenNETCF’s Smart Device Framework to easily allow using PowerManager from inside managed code. Changes in the state of PowerManager are displayed in a MessageBox. When you click the Test softkey, a test will run for 15 seconds. Try running this test on a physical Windows Mobile 6 Professional Device and see what happens if the device is switched to Idle. You will find that the application is paused until the device is powered up again, meaning the application does not have too much influence on the battery life. Play with the menu settings to prevent the device from going to idle. On a Windows Mobile 6 Standard Device, effects will be more dramatic, since these devices are either on or off. This means that an application that periodically wakes up will drain the battery as long as the device is switched on.

For more information about dealing with batteries on Windows Mobile Device, you can take a look at Webcast in which we showed this sample code. The Webcast on Developing Battery-Friendly Applications is currently available for on-demand viewing.
Last edited Dec 3 2008 at 2:48 AM  by Maarten_MVP, version 2
BobLi wrote  Jun 2 2009 at 7:28 AM  
Hi, Maarten. When the sample code is available for download. Or could you send it my mailbox (china.libo [AT] please. Thanks!

Page view tracker