CordovaHow to detect the state of the network connection