How to display a dialog to a user when the internet is or gets switched off in Phonegap

Share
phonegap


Phonegap is an amazing framework. It makes building android apps a breeze.

In this post, we will learn the technique of showing a user a native dialog box when the mobile device does not have an internet connection.



The code is as follows:

Explanation:
The  whenOffline()  functions is fired as soon as the device is not connected to the internet.
We then use  navigator.notification.alert to display the alert dialog box to the user.


no-internet-alert-Phonegap

0 comments :

Post a Comment

Written by Sundeep Machado © 2007 - 2018 Sundeep Machado

You can get in touch with him on and Twitter