including checking the network state with phonegap