Question

I am currently using apples Reachability example to detect for an available connection but what I need is to be able to detect if a WWAN connection is 2G or 3G. For the purposes of the application downloading a file to determine signal speed is not a solution and using the status bar to read the connection has also been dismissed.

I am currently using MKNetworkKit to handle my requests.

Any help is appreciated Thank you.

Was it helpful?

Solution

The SCNetworkReachability interface can help you with that. Basically, you create a so-called reachability reference and then call SCNetworkReachabilityGetFlags on it to get information about the connection.

The returned flags include kSCNetworkReachabilityFlagsIsWWAN, which tells you whether you are connected via WiFi or the cell network. AFAIK it cannot be used to tell the difference between 2G and 3G, though.

See Apple's Reachability sample app for an implementation. In most cases, you should be able to directly use the included Reachability class in your project.

OTHER TIPS

You can't detect the network type, Reachability can manage only these network status:

typedef enum
{
    // Apple NetworkStatus Compatible Names.
    NotReachable = 0,      // No connection
    ReachableViaWiFi = 2,  // Connecte on WIFI
    ReachableViaWWAN = 1   // Connected on 2G, 3G or 4G network.
} NetworkStatus;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top