[code]function MyNetworkReachabilityListener(event)
print( “address”, event.address )
print( “isReachable”, event.isReachable )
print(“isConnectionRequired”, event.isConnectionRequired)
print(“isConnectionOnDemand”, event.isConnectionOnDemand)
print(“IsInteractionRequired”, event.isInteractionRequired)
print(“IsReachableViaCellular”, event.isReachableViaCellular)
print(“IsReachableViaWiFi”, event.isReachableViaWiFi)
–[[ If you want to remove the listener, call network.setStatusListener(“www.apple.com”, nil)
g_Counter = g_Counter + 1
if g_Counter > 3 then
print(“removing event listener”)
– event:removeEventListener()
network.setStatusListener( “www.apple.com”, nil)
end
–]]
end
if network.canDetectNetworkStatusChanges then
network.setStatusListener( “www.apple.com”, MyNetworkReachabilityListener )
else
print(“network reachability not supported on this platform”)
end
[/code]
Test whether this Reachability instance is of interest.
If so, then test what kind of network transition it is:
Is the host reachable? isReachable;
Is the connection up? isConnectionRequired;
Will it come up automatically? isConnectionOnDemand;
Will the user have to enter a password? isInteractionRequired;
Is the connection slow? isReachableViaCellular;
Is the connection fast? isReachableViaWiFi;
[import]uid: 24 topic_id: 9858 reply_id: 35952[/import]