It would be really great if there was a built-in function that checks to see if the user is currently online. That way we can use network.request, network.download, system.openUrl, etc. without having to put in a specific timeOut function to prevents it from loading endlessly when they are in airplane mode or out of service/wifi range. I’ve heard that that kind of endless loading can make apple reject apps from the app store.
Thanks,
Matt
W2MD [import]uid: 10211 topic_id: 9858 reply_id: 309858[/import]
–[[ 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]