Skip to main content
Version: v5

Battery Status

Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the BatteryStatus plugin docs.

https://github.com/apache/cordova-plugin-battery-status

Stuck on a Cordova issue?

Don't waste precious time on plugin issues.

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Installation

$ npm install cordova-plugin-battery-status 
$ npm install @awesome-cordova-plugins/battery-status
$ ionic cap sync

Supported Platforms

  • iOS
  • Android
  • Windows
  • Browser

Usage

React

Learn more about using Ionic Native components in React

Angular

import { BatteryStatus } from '@awesome-cordova-plugins/battery-status/ngx';

constructor(private batteryStatus: BatteryStatus) { }

...


// watch change in battery status
const subscription = this.batteryStatus.onChange().subscribe(status => {
console.log(status.level, status.isPlugged);
});

// stop watch
subscription.unsubscribe();