How to System.Device.BatteryState

Hello,

I am lokeng for how to handle “System.Device.BatteryState”.

Any advice would be appreciated.

What do you mean by how to handle? The documentation makes it read like an enum that’s pretty easy to use. What’s not working?

Tim, thanks for the answer.

In the moment I have no clue how to handle it.

Here’s a simple sample:

' Add this e.g. to MobileButton.Pressed-Event
Var data As System.DeviceData = System.Device

Select Case data.BatteryState
Case System.DeviceData.BatteryStates.Charging
  MessageBox("Charging")
Case System.DeviceData.BatteryStates.Full
  MessageBox("Full")
Case System.DeviceData.BatteryStates.Unknown
  MessageBox("Unknown")
Case System.DeviceData.BatteryStates.Unplugged
  MessageBox("Unplugged")
End Select
1 Like

Could you add this example to the documentation?

1 Like

Thanks Martin and Christian!

Works perfectly.

1 Like

@Christian_Schmitz - And done. Thanks.

@Thomas_Nauck1 - Please mark my post as solution. Thanks.

1 Like