Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

imho

macrumors newbie
Original poster
Jul 31, 2008
29
0
Is it possible to detect network type switching (e.g WIFI to 3G) automatically with say a callback or something?

I checked the Reachability sample, it doesn't really do that at all. The only other way i could think of is to constantly poll the network type which i'm sure is a pretty dumb and inefficient solution.

Thanks.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I checked the Reachability sample, it doesn't really do that at all. The only other way i could think of is to constantly poll the network type which i'm sure is a pretty dumb and inefficient solution.

Really? I thought it did. I'm not on a Mac to check right now...
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
It does, here's a link to the Readme: http://developer.apple.com/iphone/library/samplecode/Reachability/listing6.html.

"ReachableViaWiFiNetwork" and "ReachableViaCarrierDataNetwork" tell you whether you're running over Wifi or 3G respectively.

Thought so, although this might have been a better quote from the readme

Reachability runs asynchronously and will report back changes to the network state and to the reachability of remote hosts as those changes happen.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.