I want to check the status of my connection but it does not work, I followed the documentation but it does not work.
app.module.ts
providers: [
Network,
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
login.ts
export class LoginPage {
constructor(
public navCtrl: NavController,
public navParams: NavParams,
private network:Network,
) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
ionViewDidEnter(){
console.log('ok');
this.network.onConnect().subscribe(data => console.log(data),err => console.log(err));
this.network.onDisconnect().subscribe(data => console.log(data),err => console.log(err));
}
the documentation says that this should work but it does not work, I also disconnect my network card and then connect, but it does not detect the change of connected and disconnected