Battery Status
Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the BatteryStatus plugin docs.
联系我们?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.
Ionic 电量Battery Status插件的安装(Installation)
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
Ionic 电量Battery Status插件支持的平台(Supported Platforms)
- iOS
- Android
- Windows
- Browser
Ionic 电量Battery Status插件的用法(Usage)
import { BatteryStatus } from '@ionic-native/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();