Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect carrier connection type (3G / EDGE / GPRS)

Tags:

How can i get the type of connection of a carrier network?

  • I'm able to get if connection is WIFI or WWAN using Reachability class
  • I'm able to get network flags

    Reachability Flag Status: WR t------ localWiFiStatusForFlags

  • I'm able to get WIFI SSID using CaptiveNetwork

Supported interfaces: ( en0 )

en0 => {       BSSID = "xx:xx:xx:xx:xx:xx";       SSID = MyWifiNetwork;       SSIDDATA = <x1x1x1x1 x1x1x1x1 x1>;   }   

But i'm not able to differenziate 3G, EDGE or GPRS connection.

Any idea also using iOS private API?

thanks.

like image 297
elp Avatar asked Jun 15 '12 11:06

elp


People also ask

Is EDGE network 2G or 3G?

EDGE, or Enhanced Data GSM Evolution, is another type of 2G technology network. EDGE is slightly faster than GPRS with a download speed over two-times faster at 384Kbps. Because of its speed, it's sometimes referred to as a 2.5G network.

What does EDGE mean on cellular data?

Enhanced Data rates for GSM Evolution (EDGE) also known as Enhanced GPRS (EGPRS), IMT Single Carrier (IMT-SC), or Enhanced Data rates for Global Evolution) is a digital mobile phone technology that allows improved data transmission rates as a backward-compatible extension of GSM.

Why does it say EDGE instead of 3G?

EDGE is sometimes called a 2.5G network as it also has some characteristics of a 3G network but it doesn't satisfy the specification. Therefore you can say that EDGE lie between 2G and 3G.

Why does mobile data show EDGE?

GPRS is a 2.5G wireless communication that is supposed to give you 56kbps - 114 kbps while EDGE is denoted by the symbol E. The EDGE is the next level up giving you roughly twice the bandwidth of GPRS. On the other end is HSDPA denoted by the symbol H which is the next generation of 3G. It is called 3G+ or 3.5G.


2 Answers

From iOS 7 on you can use:

CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new]; NSLog(@"Current Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology); [NSNotificationCenter.defaultCenter addObserverForName:CTRadioAccessTechnologyDidChangeNotification                                                  object:nil                                                   queue:nil                                              usingBlock:^(NSNotification *note)  {     NSLog(@"New Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology); }]; 

I have also found this to detect a slow or fast connection:

- (BOOL)isFast:(NSString*)radioAccessTechnology {     if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) {         return NO;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge]) {         return NO;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) {         return NO;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) {         return YES;     } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {         return YES;     }      return YES; } 
like image 117
Ben Groot Avatar answered Oct 09 '22 09:10

Ben Groot


Here the OLD solution, using private API, in particular SoftwareUpdateServices.framework

Class NetworkMonitor = NSClassFromString(@"SUNetworkMonitor"); NSLog(@"TYPE: %d", [NetworkMonitor currentNetworkType]); 

It returns:

0: NO DATA
1: WIFI
2: GPRS/EDGE
3: 3G

hope this helps community.

like image 28
elp Avatar answered Oct 09 '22 09:10

elp