Cannot find name 'BatteryStatusResponse'

Hi,
I’m using the Ionic Native plugin for the battery (import { BatteryStatus } from ‘@ionic-native/battery-status’

I’m doing exactly the same as the example: https://github.com/apache/cordova-plugin-battery-status

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

But I keep getting the error 'Cannot find name ‘BatteryStatusResponse’?

Many thanks

Si

I eventually got this working:

Put these in your class

private batterySubscription: Subscription;
public batteryLevel: number;
public pluggedInString: string;

this.batterySubscription = this.batteryStatus.onChange().subscribe(
(status: BatteryStatusResponse) => {
this.batteryLevel = status.level;
if (status.isPlugged === true) {
this.pluggedInString = ‘(Charging: AC)’;
} else {
this.pluggedInString = ‘Not Charging’;
}
console.log('LEVEL ’ + status.level + ’ PLUGGED IN ’ + status.isPlugged);
}
);

The above should goto ngOInit()

and then have:

ionViewWillLeave() {
this.batterySubscription.unsubscribe();
}

Unfortunately my view isn’t updating when new values come in, so you have to leave and come back to see the update. But it’s better than nothing.