x


iOS internet reachability for other platform?

Hi,

Currently trying to find in the doc if there is a way to check the internet connection status for a standalone build so that for example I properly adapt my features if the user is connected or not.

there is such a check, but only for iphone it seems. iPhoneSettings.internetReachability

How can I then detect is the user is online or not when in standalone?

thanks for your help,

Jean

more ▼

asked Oct 13 '10 at 08:24 AM

Jean Fabre gravatar image

Jean Fabre
3.1k 69 76 103

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

FYI iPhoneSettings.internetReachability also works for android

but for general cases try somethign like this

IEnumerator doInternetStuff() {

float duration = 0.0f;
float connectionTimeOut = 7.0f;

WWW www = new WWW(url); while(!www.isDone && duration < connectionTimeOut && www.error == null) { duration += Time.deltaTime; yield return 0; }

if(www.error != null || duration >= connectionTimeOut)
{   
    print("time out!");
    return false;
}

else
{
    //do stuff with internet data
}

}

so if it times out, then they dont have internet access, or just cant get the internet data, otherwise you are good to go.

more ▼

answered Jul 05 '11 at 06:37 PM

kablammyman gravatar image

kablammyman
67 2 3 6

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x117
x90
x42
x9

asked: Oct 13 '10 at 08:24 AM

Seen: 2486 times

Last Updated: Jul 05 '11 at 06:39 PM