Is there efficient way to check internet connectivity on mobile? here is my script but I am not sure if there is better way to do. I hope there is something simpler.
Code: Select all
local sBrowserId
on openCard
checkInternetConnection
end openCard
on checkInternetConnection
mobileControlCreate "browser"
put the result into sBrowserId
mobileControlSet sBrowserId, "visible", "false"
mobileControlSet sBrowserId, "url", "https://www.google.com"
mobileControlSet sBrowserId, "rect", the rect of current card
end checkInternetConnection
on browserFinishedLoading pUrl
mobileControlDelete sBrowserId
go to card "start"
end browserFinishedLoading
on browserLoadFailed pUrl, pError
mobileControlDelete sBrowserId
answer "Can't load server."&cr &"Please check internet connection."
end browserLoadFailed
Cheers,
Louis