Search code examples
iosiphonenetwork-programmingwifidetect

Is there a callback/delegate to tell that the device is back to be connected (to carrier service or wifi) after offline?


Assume a device was offline with no service neither WiFi to begin with, is there a callback/delegate to tell that the device is back to be connected once the service or WiFi is available? or do we have to proactively pull the status?


Solution

  • You could check it with the Rechability class:

    The Reachability sample application demonstrates how to use the SystemConfiguration framework to monitor the network state of an iPhone or iPod touch. In particular, it demonstrates how to know when IP can be routed and when traffic will be routed through a Wireless Wide Area Network (WWAN) interface such as EDGE or 3G.

    here is an Example