phonegap

 

iPhone: Reachability API use

Page history last edited by Shazron Abdullah 1 wk ago
//### EDGE only 

function testReachable() {
          // no http:// prefix!
          navigator.network.isReachable("www.google.com", testReachable_callback);
          // OR by ipAddress
          navigator.network.isReachable("212.32.454.32", testReachable_callback, { isIpAddress: true});
}
 
// NetworkStatus: 0 for NotReachable, 1 for ReachableViaCarrierDataNetwork,
// 2 for ReachableViaLocalWifiDataNetwork
function testReachable_callback(reachability)
{
          alert("hostName: " + reachability.hostName + " " +
                      "ipAddress: " + reachability.ipAddress + " " +
                      "remoteHostStatus: " + reachability. remoteHostStatus + " " +
                      "internetConnectionStatus: " + reachability. internetConnectionStatus + " " +
                      "localWiFiConnectionStatus: " + reachability. localWiFiConnectionStatus
                );
}

Comments (1)

profile picture

Radu said

at 12:34 am on Sep 21, 2009

Is this working on version 0.7.3 or only on EDGE version? I've tried it on 0.7.3 but the callback function is never executed.

You don't have permission to comment on this page.