How - or what's the best way - to retrieve the device's current battery level in .NET CF 3.5 on Windows Mobile 5 and 6?
3 Answers
I think you want to use the Microsoft.WindowsMobile.Status
namepsace (specifically the SystemState
class.
using Microsoft.WindowsMobile.Status;
...
BatteryLevel batteryLevel = SystemState.PowerBatteryStrength;
BatteryState batteryState = SystemState.PowerBatteryState;
See this post for the full code sample.

- 1,187
- 19
- 32

- 144,213
- 56
- 264
- 302
-
If you visit the link - it might be worthwhile to look at the other "not accepted" answer. It has some good information in it. You should probably update the answer (if you're so inclined) to reflect this? :) – OldTinfoil Aug 13 '14 at 13:11
You probably want the State Notification Broker class that Noldorin is recommending. I don't think it gives you very fine grain information. You get information like Low or Very Low. If you need specific percentages consider using GetSystemPowerStatusEx.
HOWTO: Get the Device Power Status GetSystemPowerStatusEx

- 5,285
- 6
- 46
- 63
To add to CJ's response you can find a code example of how to get detailed battery information from http://www.codeproject.com/kb/mobile/Wimopower1.aspx . This information includes the batter's power level, temperature, whether it is charging or draining, and the amount of current being drawn.

- 2,230
- 1
- 20
- 28