Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Detect 3G or WiFi

I am not sure if this is possible, but I have this scenario.

I have a website displayed in my UIWebView which has the link set in a UISegmentedController. They website can detect if you are on wifi or on the 3g network.

Now the segmented controller points to 2 different pages: 1 - An iPhone friendly login screen 2 - The home page, once you are logged in.

Now here is the question:

Can I program my application to detect whether it is to WIFI or 3G (I know you can do this), but then based on the answer go to segment 1 or 2

Kind of like this:

if (iPhone device is on 3g) {     Go to Segment 1; } else {     Go to Segment 0; } 
like image 333
jwknz Avatar asked Oct 29 '11 11:10

jwknz


People also ask

How do I know if iPhone is using Wi-Fi or data?

Look for the WiFi symbol in the upper left of the screen. Turn off cellular data. If you are able to connect to the Internet then you are using WiFi (unless you are tethered to a hotspot by Bluetooth or USB). Also you will see the WiFi symbol at the top of the screen.

Will iPhone automatically use Wi-Fi instead of data network?

If a setting is off, iPhone uses only Wi-Fi for that service. Note: Wi-Fi Assist is on by default. If Wi-Fi connectivity is poor, Wi-Fi Assist automatically switches to cellular data to boost the signal.

Does iPhone default to Wi-Fi or cellular?

An iPhone will automatically switch from the cellular connection when it successfully makes a Wi-Fi connection. Likewise, it will go back to cellular connectivity if the user turns Wi-Fi off or the connection drops.

Why is my iPhone not picking up 3G?

Go to Settings → General → Cellular → Enable 3G: ON. If #1 is OK, try switching ON the "Airplane Mode" for about 10 seconds and then turn it back OFF. Go to Settings → Airplane Mode: ON, wait 10 seconds and turn OFF. If #2 doesn't work, reset the network settings.


1 Answers

Using the code that Apple has provided here

Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier];  NetworkStatus status = [reachability currentReachabilityStatus];  if(status == NotReachable)  {     //No internet } else if (status == ReachableViaWiFi) {     //WiFi } else if (status == ReachableViaWWAN)  {     //3G } 
like image 109
James Webster Avatar answered Sep 22 '22 20:09

James Webster