>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 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.
The Battery Info module provides APIs for querying the charger type, battery health status, and battery charging status.
## Modules to Import<a name="section199443271307"></a>
## Modules to Import
```js
```js
importbatteryInfofrom'@ohos.batteryInfo';
importbatteryInfofrom'@ohos.batteryInfo';
...
@@ -16,264 +16,63 @@ import batteryInfo from '@ohos.batteryInfo';
...
@@ -16,264 +16,63 @@ import batteryInfo from '@ohos.batteryInfo';
SystemCapability.PowerManager.BatteryManager
SystemCapability.PowerManager.BatteryManager
## Attributes<a name="section0536924123914"></a>
## Attributes
Describes battery information.
Describes battery information.
<aname="table20633101642315"></a>
| Name | Type | Readable | Writable | Description |
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p103961315181818"><aname="p103961315181818"></a><aname="p103961315181818"></a>Battery state of charge (SoC) of the current device, in unit of percentage.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p238673617568"><aname="p238673617568"></a><aname="p238673617568"></a>Battery charging state of the current device.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p1365563875614"><aname="p1365563875614"></a><aname="p1365563875614"></a>Battery health state of the current device.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p19264101622016"><aname="p19264101622016"></a><aname="p19264101622016"></a>Charger type of the current device.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p127111826172018"><aname="p127111826172018"></a><aname="p127111826172018"></a>Battery voltage of the current device, in unit of microvolt.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p9298104612205"><aname="p9298104612205"></a><aname="p9298104612205"></a>Battery technology of the current device.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p7843573202"><aname="p7843573202"></a><aname="p7843573202"></a>Battery temperature of the current device, in unit of 0.1°C.</p>
<tdclass="cellrowborder"valign="top"width="42.6%"headers="mcps1.1.6.1.5 "><pid="p15590255280"><aname="p15590255280"></a><aname="p15590255280"></a>Whether the battery is supported or present.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p9910201913391"><aname="p9910201913391"></a><aname="p9910201913391"></a>The battery is being charged.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p1210733413414"><aname="p1210733413414"></a><aname="p1210733413414"></a>The battery is not being charged.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p540191793918"><aname="p540191793918"></a><aname="p540191793918"></a>The battery is in the healthy state.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p2399117183918"><aname="p2399117183918"></a><aname="p2399117183918"></a>The battery is overheated.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p203691717193914"><aname="p203691717193914"></a><aname="p203691717193914"></a>The battery voltage is over high.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p20970177153913"><aname="p20970177153913"></a><aname="p20970177153913"></a>The battery temperature is low.</p>
<tdclass="cellrowborder"valign="top"width="33.043304330433045%"headers="mcps1.1.4.1.3 "><pid="p13971137153918"><aname="p13971137153918"></a><aname="p13971137153918"></a>The battery is dead.</p>