Ionic Battery Status on iOS

Hi,

why does my the battery status do not change when starting the app with IonicView???

app.module.ts

import { BatteryStatus } from '@ionic-native/battery-status'; 
...
 providers: [
    StatusBar,
    SplashScreen,
    IonicStorageModule,
    BatteryStatus,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]

myHome.ts

import { BatteryStatus } from '@ionic-native/battery-status';
...
constructor(public navCtrl: NavController, public navParams: NavParams, public modelCtrl: ModalController,
  public platform: Platform, public storage: Storage, public batteryStatus: BatteryStatus) {
    this.getUsers();
    this.getUserCount();
    //this.getBatteryStatus();
    
    platform.ready().then( () => {
        batteryStatus.onChange().subscribe( (status) => {
          this.level = status.level;
          this.isPlugged = status.isPlugged;
          alert('battery status: '+status.level);
        });
      });
      this.debugStr = "Start\n";
      alert('battery status: '+this.level);
      
  }

Because the Battery Status plugin is not one of the plugins supported by Ionic View: https://docs.ionic.io/tools/view/#supported-plugins

Sujan,

thank you. What is the best way testing/debugging Ionic3 apps for iOS when developing on a Windows PC?

Use something like Ionic Package to build the app, then distribute to your iPhones with HockeyApp or similar. (Very slow loop - so think about getting an old Mac… or building a Hackintosh)

A post was split to a new topic: Why battery status update after plugging the mains charger in/out takes place on the Android after tapping the touch screen?