Network doesn't fires events

Hi!

I’m using the Network plugin of Ionic Native but it doesn’t fire events when I connect / disconnect my wifi connection in order to test if it’s working. I have the following code:

let subscribeNetwork = network.onConnect().subscribe(() => {
console.log(“event_connected”);
this.device_connected = true;
});
let unsubscribeNetwork = network.onDisconnect().subscribe(() => {
console.log(“event_disconnected”);
this.device_connected = false;
});

I’ve imported it inside the app.module.ts file and also inside home.ts (where is that snippet of code is from). Also, I have loaded it inside the constructor with private network: Network.

What’s wrong here? Someone can help?

Are we certain that the plugin itself is really installed?

Well, it doesn’t fires errors and the folder is present, how I can test it besides those facts? I’ll do it if there are more ways.

One thing you could do is to remove and re-add whatever platform you are using, and watch to make sure it is listed as being added during that process.

Well, I have watched it, so the installation I think is not the problem. What other thing can be?

Just to confirm: you’re running this on a mobile device, with the Cordova platform installed? Not ionic serve on your desktop.

Yes, I’m running it inside Android with the Cordova platform installed

Do you have a debug output from the Android SDK or device?

Yes, I have, but it doesn’t log “event_connected” or “event_disconnected” as it should because of the previous code I have posted. Which output do you want? Cause there’re infinite lines of code.

HI, someone has fixed this issue?

For me it works only on device. Can’t have it working on browser with ionic serve.
:frowning: