Page 1 of 1

Is it possible to check internet connection for android?

Posted: Mon Nov 05, 2012 7:34 am
by intlx739r
Hello LiveCoders!

I want to check internet connection when an android app is just loaded.
If there is no internet connection, I want to make app poped up with message saying "Check your internet connection" with "OK" button.
And with touching "ok" button, I want to make app closed.

How can I make this script..?

Tommy

Re: Is it possible to check internet connection for android?

Posted: Mon Nov 05, 2012 2:32 pm
by Mark
Hi Tommy,

If I'm correct, there is no special feature for Android to check the internet connection. The following should work:

Code: Select all

on mouseUp
     put empty into fld 1
     get url "http://economy-x-talk.com"
     put the result into rslt
     if rslt is not empty then
          beep
          answer "Check your internet connection"
     end if
     put rslt into fld 1
end mouseUp
and an alternative way could be

Code: Select all

on mouseUp
     get hostnametoaddress("economy-x-talk.com")
     if it is empty then
          beep
          answer "Check your internet connection"
     end if
end mouseUp
There are other, more complicated ways, but this should do. You can replace the address of my website with your own or e.g. with Google's.

Kind regards,

Mark

Re: Is it possible to check internet connection for android?

Posted: Mon Nov 05, 2012 4:20 pm
by intlx739r
Dear Mark,
Thank you very much for your help.
I wonder how you create scripts.
You are a genius.

Thanks alot.. :D

Best regards,
Tommy