7

I'm using the reachability API to detect my current connection, but I can only distinguish between WIFI and 3G.

I get the following flags:

LTE: kSCNetworkReachabilityFlagsIsLocalAddress|kSCNetworkReachabilityFlagsIsWWAN|kSCNetworkReachabilityFlagsTransientConnection|kSCNetworkReachabilityFlagsReachable

WIFI: kSCNetworkReachabilityFlagsIsDirect|kSCNetworkReachabilityFlagsReachable

The problem is that LTE returns the same flags as a 3G connection. Is there any way to determine whether the user currently has LTE or 3G?

CodaFi
  • 43,043
  • 8
  • 107
  • 153
Gilad Novik
  • 4,546
  • 4
  • 41
  • 58
  • Are you interested in the higher bandwidth that comes with the network or just the type of network itself? There is a workaround for the former, but not the latter. – bendu Apr 15 '12 at 03:16
  • I guess the workaround is to simply try to download something and track the speed? – Gilad Novik Apr 15 '12 at 03:33

2 Answers2

15

As of iOS 7, you can find this out using the currentRadioAccessTechnology property of CTTelephonyNetworkInfo in the CoreTelephony framework.

#import <CoreTelephony/CTTelephonyNetworkInfo.h>

CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new];

if ([networkInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {
    // ...
}
jzzocc
  • 397
  • 5
  • 7
  • 2
    Does anyone know why there is no documentation on the `currentRadioAccessTechnology` method? https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/CTTelephonyNetworkInfo/Reference/Reference.html – Robert Feb 05 '14 at 12:52
  • This method added iOS7.0 but It wasn't add documents. check the header file "CTTelephonyNetworkInfo.h" ```oc @property (nonatomic, readonly, retain) NSString* currentRadioAccessTechnology __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0); ``` – TopChul May 15 '14 at 08:35
  • 1
    This still is not formally documented which makes me nervous. I put it in a try catch so that I can have some default behavior if it gets taken away. – Kyle Jurick Feb 05 '15 at 16:10
3

I wonder if this hidden Core Telephony API can provide you with enough info for you to determine whether you're attached to an LTE or a slower technology.

CTRegistrationGetCurrentMaxAllowedDataRate();

It might be worth experimenting with.

More about using private APIs here: iPhone mobile number using Core telephony

However, I've read that your app will be rejected by apple if you use private APIs.

Community
  • 1
  • 1