Battery Info
NOTE: The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Battery Info module provides APIs for querying the charger type, battery health status, and battery charging status.
Modules to Import
import batteryInfo from '@ohos.batteryInfo';
System Capabilities
SystemCapability.PowerManager.BatteryManager
Attributes
Describes battery information.
Battery state of charge (SoC) of the current device, in unit of percentage. |
||||
Battery voltage of the current device, in unit of microvolt. |
||||
Battery temperature of the current device, in unit of 0.1°C. |
||||
-
Example
import batteryInfo from '@ohos.batteryInfo'; var batterySoc = batteryInfo.batterySOC;
BatteryPluggedType
Enumerates charger types.
BatteryChargeState
Enumerates charging states.
BatteryHealthState
Enumerates battery health states.