I’m using the simplest code to detect for an internet connection, and I’ve been testing it in various situations.
[lua]function internetAvailable()
local connectAttempt = require(‘socket’).connect(‘google.com’, 80)
if connectAttempt == nil then
debug(“Unble to establish internet connection”)
return false
end
debug(“Able to establish internet connection”)
connectAttempt:close()
return true
end[/lua]
In certain situations, i.e. there’s Wi-Fi but no internet, the app will completely hang.
Has anyone come up with a better solution? [import]uid: 6084 topic_id: 7291 reply_id: 307291[/import]