Recently, I have been working on some of the Hybrid Application . I come across a requirement to detect that whether device is connected to Internet or not? Since I were developing Hybrid Application so I had an option to detect Internet using HTML5 . However this approach had a problem in the browsers do not support HTML5. Better approach to detect Internet connectivity of device is through Cordova (PhoneGap).

You can detect device is online or offline in if condition as following,




If device is connected to internet then you can check type of the connection in device using Cordova as well. You can do that as following



Make sure you have added the reference of cordova to work with this.



Best practice is to create a function to detect device connectivity status and call that function when the device is ready. I hope you find this post useful. Thanks for reading.



3 thoughts on “How to detect Device is connected to Internet using Cordova

  1. hi … can we download youtube video using cordova ? am new to this cordova…i have written code, which downloads but not playing , auto closses when opened…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s