Udostępnij za pośrednictwem


Battery Class

Definition

Methods and properties for battery and charging information of the device.

public static class Battery
Inheritance
System.Object
Battery

Remarks

Platform specific remarks:

- Android: Battery_Stats permission must be set in manifest.

- iOS: Simulator will not return battery information, must be run on device

- UWP: None

Properties

ChargeLevel

Gets the current charge level of the device from 0.0 to 1.0.

EnergySaverStatus

Gets the current energy saver status of the device.

PowerSource

Gets the current power source for the device.

State

Gets the charging state of the device if it can be determined.

Events

BatteryInfoChanged

Event trigger when battery properties have changed.

EnergySaverStatusChanged

Event that is triggered when energy saver status changes.

Applies to