Differences

This shows you the differences between two versions of the page.

Link to this comparison view

check_the_network_connection_in_phonegap [2013/04/25 13:26]
Joel Dare
check_the_network_connection_in_phonegap [2020/06/01 22:53]
Line 1: Line 1:
-====== Check the Network Connection in PhoneGap ====== 
  
-Here's a little bit of Javascript code that will check the network connection in PhoneGap to make sure that the internet is available for public requests. In order to be in the app store your app must work in both online and offline modes. This simple code will satisfy those requirements. 
- 
-<​code>​ 
-// check to see if the network is reachable 
-setTimeout(function() { 
-  navigator.network.isReachable("​www.google.com",​ 
-  networkConnectionCheck,​ {isIpAddress:​false});​ 
-}, 500); 
- 
-function networkConnectionCheck(reachability) { 
-  if ( reachability.remoteHostStatus == NetworkStatus.NOT_REACHABLE ) { 
-    navigator.notification.alert("​You appear to be offline.",​ "your app name"​);​ 
-  } 
-}; 
-</​code>​ 
- 
-<​html>​ 
-<script type="​text/​javascript">​document.write(unescape("​%3Cscript src='​http"​ +  (document.location.protocol == '​https:'​ ? '​s'​ : ''​) + "://​www.coffeecup.com/​api/​sdrive/​forms/​form.js?​name=phonegap%26slug=171222%26width=552%26height=467'​ type='​text/​javascript'​%3E%3C/​script%3E"​));</​script>​ 
-</​html>​ 
comments powered by Disqus
check_the_network_connection_in_phonegap.txt · Last modified: 2020/06/01 22:53 (external edit)