Skip to main content

Battery

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read the battery: level in percent, whether it is charging, discharging, not charging or full, and on Android what it is plugged into. These call app_battery.

Battery​

func (d *Device) Battery(ctx context.Context) (BatteryStatus, error)

Battery reads the battery.

Examples​

Read the battery​

battery, err := dev.Battery(ctx)
if err != nil {
return err
}
if battery.Present && battery.Level != nil {
fmt.Printf("%d%%, %s\n", *battery.Level, battery.State)
}

The same call from the command line, mobium battery, printed on an Android 15 emulator:

42%, discharging, not plugged in

mobium battery on an Android 15 emulator

mobium battery on an Android 15 emulator