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
A:
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.
Noldorin
2009-03-25 14:07:49
+2
A:
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
CJCraft.com
2009-03-25 17:29:16