Battery Status

Improve this doc

$ ionic plugin add cordova-plugin-batterystatus

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

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

Supported platforms

Usage

import {BatteryStatus} from 'ionic-native';



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

// stop watch
subscription.unsubscribe();

Static Methods

onChange()

Watch the change in battery level

Returns: Observable Returns an observable that pushes a status object

onLow()

Watch when the battery level goes low

Returns: Observable<StatusObject> Returns an observable that pushes a status object

onCritical()

Watch when the battery level goes to critial

Returns: Observable<StatusObject> Returns an observable that pushes a status object

API

Native

General