- Home /
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
Answer by kablammyman · Jul 05, 2011 at 06:37 PM
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.
Answer by tonic · Jun 27, 2014 at 02:15 PM
To truly know you're online, you need to implement "captive portal detection", to know if you're e.g. hitting a public WiFi login page. So just checking Application.internetReachability or doing a Ping to some address doesn't guarantee you can successfully make connections or make WWW requests.
I have made an easy asset called Internet Reachability Verifier. It keeps you up-to-date whether you have verified internet access (WWW requests can be done). More info here: http://j.mp/IRVUN
Your answer
Follow this Question
Related Questions
Ping class producing false positives, alternative to check connectivity? 3 Answers
Connecting online? 0 Answers
How to create a system that shows all lobbies available to join using mirror? 0 Answers
Why is my game connecting to config.uca.cloud.unity3d.com on startup after recent Unity update? 2 Answers