Determine network connection (WiFi or 2/3G)

I’m building a business app which should be able to adapt itself to a slow or fast connection.

Is it possible to determine which network type (WiFi, 2G, 3G or 4G) it is using, without having to fall back to a less precise method like doing a small speed test?

You will have to use CTTelephonyNetworkInfo and catch the subscriberCellularProviderDidUpdateNotifier notification.

Grab Jason King’s excellent iOSKit and then use the Reachability class.

Aah, thanks. Should examine that project more closely.

NB: I still hope that Xojo puts a bit more speed in iOS, as the 2015R3 release was a bit small on the iOS side. Somehow I prefer not to use external declares/kits and, if possible, only what comes standard out of the (Xojo) box.

There’s nothing really wrong with using declares; they just expose parts of the framework not exposed by the Xojo iOS framework. But I have heard from a good source that the Xojo iOS framework is going to be getting some new goodies now that 64-bit desktop has shipped. Keep watching this space. :wink:

I try to keep my projects as clean as possible. In that light I want to avoid adding something I don’t need. Afaik there is not an easy way to only take the thing you need from those Kits. Maybe it’s simple and I just need to be told how ;).

I hope your “good source” is right. Although I’m capable of learning every language/tool I need (I know Objective C and Swift for instance), there’s no tool for iOS other than Xojo, with it’s nice/clean BASIC-like language, that makes me smile :). Therefore I hope they progress steadily so I never have to look further.

You won’t know you need it until you start using it :wink:

For Reachability its is simple, there are no dependencies on any of the other modules or classes. You can simply copy it out of the Extensions module and use it directly with no changes!