Is it possible to check internet connection for android?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
intlx739r
Posts: 15
Joined: Mon Oct 29, 2012 5:22 pm

Is it possible to check internet connection for android?

Post by intlx739r » Mon Nov 05, 2012 7:34 am

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

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

Post by Mark » Mon Nov 05, 2012 2:32 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

intlx739r
Posts: 15
Joined: Mon Oct 29, 2012 5:22 pm

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

Post by intlx739r » Mon Nov 05, 2012 4:20 pm

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

Post Reply