Is it possible to detect LTE connection using iOS SDK?
Asked Answered
W

2

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?

Wolford answered 15/4, 2012 at 2:53 Comment(2)
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.Gambrinus
I guess the workaround is to simply try to download something and track the speed?Wolford
I
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]) {
    // ...
}
Isabelisabelita answered 22/10, 2013 at 20:18 Comment(3)
Does anyone know why there is no documentation on the currentRadioAccessTechnology method? developer.apple.com/library/ios/documentation/…Coenosarc
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); Ozoniferous
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.Pyridine
E
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.

Enneahedron answered 5/1, 2013 at 1:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.