Hey guys, I have just about finished my app (after 8 looong months). The only thing left for me to do is figure out how to configure my app to handle a slow internet connection.
I use Network Link Conditioner to simulate bad connects, and my app just does not run well. My app does rely on internet (it is as good as useless if there is a bad or no connection). Most of my data/images are grabbed from my Conorium server, and when I have slow internet there is just blank white space where a user’s email or name should be (for images I have placeholders). If I had to click on something, I get errors because certain elements have failed to load.
I do have a some code to detect timeouts (3 seconds), and then go to a 'connection error" scene where a user can retry to load a scene. Unfortunately it does not work every time there is bad connection. Here is the code:
==================================
hasInternet = false
function networkListener( event )
if ( event.isError ) then
timer.cancel(checkTime)
hasInternet = false
print(“NO INTERNET”)
composer.showOverlay( “connection”, fade, 0 )
ignoreLayer = true
– errorHandling()
else
timer.cancel(checkTime)
print("event.response = " … event.response)
print("time to live = " … netTime … “seconds”)
print(“HAS INTERNET”)
hasInternet = true
ignoreLayer = false
end
end
params = {}
params.timeout = 3
netTime = 0
function netTimer()
netTime = netTime + .1
end
checkTime = timer.performWithDelay(100,netTimer,0)
checkNet = network.request( “http://www.XXXXX/check.php”, “POST”, networkListener,params) – LEFT OUT URL INTENTIONALLY
==================================
Would love some advice on this…
Thanks!