Ionic Native - Network in Browser


I’m wondering how you would use the Native APIs like Network while still supporting ionic serve for development?

For example, I rely on Network plugin to determine connection state, e.g. to load a google places autocomplete and show an availability message. I expected that the native APIs would somehow handle the ionic serve scenario and only use cordova when available. Do I really neet to add “isBrowser” checks manually?



I too am wondering this. Ionic serve doesn’t work for me because my app has several HTTP requests


I use this code to check whether i’m on device or using browser:

this.onDevice =‘cordova’);
if (this.onDevice) { // using actual device
/* check the network connection using native cordova network plugin /
if (Network.connection !== “unknown” && Network.connection !== “none”) = true;
else = false; // initial connection status
} else { // using browser
check the network connection using HTML5 API */ = navigator.onLine;

seems to be working Ok, dunnno if that’s the right way tho.