Does anyone know how to determine the active network type at the specific moment: 2G, 3G or WiFi.
For example, at a specific moment there could be enabled 3G, but the used network type could be 2G.
Does anyone know how to determine the active network type at the specific moment: 2G, 3G or WiFi.
For example, at a specific moment there could be enabled 3G, but the used network type could be 2G.
The
SCNetworkReachability
interface can help you with that. Basically, you create a so-called reachability reference and then callSCNetworkReachabilityGetFlags
on it to get information about the connection.The returned flags include
kSCNetworkReachabilityFlagsIsWWAN
, which tells you whether you are connected via WiFi or the cell network. AFAIK it cannot be used to tell the difference between 2G and 3G, though.See Apple's Reachability sample app for an implementation. In most cases, you should be able to directly use the included
Reachability
class in your project.Go to the Apple Developer site, and download a sample project called "Reachability"
It provides an example of what you would like to do.
It is worth noting that I don't believe that you can tell the difference between EDGE(2G) and a 3G connection. It's either WiFi or WWAN.