From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Double )
DoubleValue = aDeviceData.BatteryLevel

New in 2020r2

Supported for all project types and targets.

The amount of battery remaining.


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 + "%")

See Also

BatteryState property.