DeviceData.BatteryLevel
From Xojo Documentation
Read-Only Property (As Double )
The amount of battery remaining.
Notes
A value of 0.0 means the battery is full discharged. A value of 1.0 means the battery is fully charged.
Sample Code
This example enables monitoring of the battery, gets the current battery level, disables battery monitoring and then displays the level in a message box:
System.Device.BatteryMonitoringEnabled = True
Var batteryPercentage As Integer = System.Device.BatteryLevel * 100
System.Device.BatteryMonitoringEnabled = False
MessageBox("Your battery is at " + batteryLevel.ToString + "%")
Var batteryPercentage As Integer = System.Device.BatteryLevel * 100
System.Device.BatteryMonitoringEnabled = False
MessageBox("Your battery is at " + batteryLevel.ToString + "%")
See Also
BatteryState property.