Ionic 3 network information not found

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

Try subscribing in the constructor insted :

constructor(public toast: ToastController, private network: Network, private platform: Platform) {

    this.network.onConnect().subscribe(() => {
      console.log('network connected!');
      this.toast.create({
        message: 'Network connected',
        duration: 2000
      }).present();
    });

    this.network.onDisconnect().subscribe(() => {
      console.log('network was disconnected :-(');
      this.toast.create({
        message: 'Network disconnected',
        duration: 2000
      }).present();
    });

  }