Is there a way to check internet connectivity even when the app is closed, using Cordova? I am trying to create an app wherein if the phone is not connected to the internet, the data to be sent to the server is stored locally, and once the phone is connected to the internet, the data is sent. Something like what WhatsApp does while sending message offline. I am able to detect the type of connection with the following code -
var networkState = navigator.connection.type;
app.typeOfNetwork = networkState;
return (networkState != Connection.NONE);
So this code return if the phone is connected to the internet or not, though this works perfectly when the app is running, it fails to check when the app is closed. Anyway to overcome it?