Problem with cordova-plugin-network-information

Now, I write code withe Network plugin and when I disconnected network in my device, i can´t see allert in console.
Thanks.

Show us your Code, is hard to help without

checkNetwork() {
let connectSubscription = this.network.onConnect().subscribe(() => {
console.log(‘Estoy con internet’);
});

let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
  console.log('Estoy sin internet');
});

}

Srry. The problem is that i don´t now, where i should write there code, if in the constructor, ngOinit… Beause i want when press a button check if it have connection and when no connection active background mode.