I am working on an iOS app, and want to determine which type of cellular connection the device has.
I'm most interested in the kind of cellular network my device is using: 2G or 3G, or other.
However, the Reachability.h only provides checking for wifi or 3G.
How can I check for 2G, 3G, etc?
in iOS 7.0+ we have CoreTelephony framework which can provide us the required details about network type.
CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init];
NSString *currentRadio = telephonyInfo.currentRadioAccessTechnology;
if ([currentRadio isEqualToString:CTRadioAccessTechnologyLTE]) {
// LTE
} else if([currentRadio isEqualToString:CTRadioAccessTechnologyEdge]) {
// EDGE
} else if([currentRadio isEqualToString:CTRadioAccessTechnologyWCDMA]){
// 3G
}
2G / 3G cannot be distinguished via Reachability.h or any other third party libraries, as iPhone only provides network type information ( WWAN , WiFi , no Network ) to API.
However, if you are able to know the IP range of 2G or 3G network, you can determine which network speed / frequency the iPhone is using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With