hi there,
i want to check if a network connection is present, when the app gets started.
i tried.
setTimeout(() => {
console.log(Network.type);
}, 3000);
and i just get “null” even though a network connection is present.
the network.onDisconnect() and network.onConnect() handlers work correctly.
Is this maybe connected to degugging in browser?
Thanks
Because this is a native plugin you have to test it on a real device.
aha, thanks.
how can i handle this information in browser web-app though?
You could use it through navigator.onLine which is described over here:
Or if you’re using sockets, you could detect of your connected or not.
What’s the specific use case?
thanks. yes, navigator.onLine does look good.
usecase is: informing the user that he can not login / register / interact when offline