> For the complete documentation index, see [llms.txt](https://en.docs.monaca.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.docs.monaca.io/reference/core-cordova-plugins/cordova-11.0/battery-status-plugin.md).

# Battery Status Plugin

Tested Version: [2.0.3](https://github.com/apache/cordova-plugin-battery-status/releases/tag/2.0.3)

{% hint style="info" %}
This document is based on the original Cordova docs available at [Cordova Docs](https://github.com/apache/cordova-plugin-battery-status).
{% endhint %}

## Plugin ID

```javascript
cordova-plugin-battery-status
```

## Adding the Plugin

In order to use this plugin, please [enable](/products_guide/monaca_ide/dependencies/cordova_plugin.md#import-cordova-plugins) `Battery` plugin in Monaca Cloud IDE.

## API Reference

### Status object

All events in this plugin return an object with the following properties:

| Property    | Type    | Description                                |
| ----------- | ------- | ------------------------------------------ |
| `level`     | Number  | The battery charge percentage (`0-100`)    |
| `isPlugged` | Boolean | Indicates whether the device is plugged in |

### batterystatus event

Fires when the battery charge percentage changes by at least `1 percent`, or when the device is plugged in or unplugged. Returns an [object](/reference/core-cordova-plugins/cordova_10.0/battery-status.md#status-object) containing battery status.

#### Example

```javascript
window.addEventListener("batterystatus", onBatteryStatus, false);

function onBatteryStatus(status) {
    console.log("Level: " + status.level + " isPlugged: " + status.isPlugged);
}
```

#### Supported Platforms

* iOS
* Android

#### Quirks: Android

{% hint style="info" %}
The Android implementations are greedy and prolonged use will drain the device's battery.
{% endhint %}

### batterylow event

Fires when the battery charge percentage reaches the low charge threshold. This threshold value is device-specific. Returns an [object](/reference/core-cordova-plugins/cordova_10.0/battery-status.md#status-object) containing battery status.

#### Example

```javascript
window.addEventListener("batterylow", onBatteryLow, false);

function onBatteryLow(status) {
    alert("Battery Level Low " + status.level + "%");
}
```

#### Supported Platforms

* iOS
* Android

### batterycritical event

Fires when the battery charge percentage reaches the critical charge threshold. This threshold value is device-specific. Returns an [object](/reference/core-cordova-plugins/cordova_10.0/battery-status.md#status-object) containing battery status.

#### Example

```javascript
window.addEventListener("batterycritical", onBatteryCritical, false);

function onBatteryCritical(status) {
    alert("Battery Level Critical " + status.level + "%\nRecharge Soon!");
}
```

#### Supported Platforms

* iOS
* Android


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://en.docs.monaca.io/reference/core-cordova-plugins/cordova-11.0/battery-status-plugin.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
