Network connection switch event


I’m trying to create an app with a Wi-Fi Only setting. I’m using the Network class from ionic-native but the onConnect event only triggers when you are offline and go online.
I have a live sync to a remote database running in the background, I need to be able to detect a connection switch (Wi-Fi to something else for example) to be able to stop or restart the live sync.

The only workaround I’ve found is to check the connection type every x seconds. But I really don’t like this method.

Is there any event that I’m not aware of that could solve my issue?


Edit: I actually solved it, something wrong in my code with RxJS…