Hi I tried use Network plugin but it doesn´t work. I writed code in constructor, function and service, but i can´t get it to work. My ask is if any of you it happens to them like me. The code I writed it´s content in documentacion. Thanks for reading me.
import { Network } from '@ionic-native/network/ngx';
constructor(private network: Network) {
let disconnectSubscription = this.network.onDisconnect().subscribe(() => {
console.log('network was disconnected :-(');
});
let connectSubscription = this.network.onConnect().subscribe(() => {
console.log('network connected!');
// We just got a connection but we need to wait briefly
// before we determine the connection type. Might need to wait.
// prior to doing any api requests as well.
setTimeout(() => {
if (this.network.type === 'wifi') {
console.log('we got a wifi connection, woohoo!');
}
}, 3000);
});
}