Search code examples
objective-cioscocoa-touchmultitaskingreachability

iOS voip app sleeps & Reachability has changed, can I get notification?


I'm building a voip app for iOS and I'm handling working at background.

So far, i have iOS listening to the voip socket while app sleeps and wake it uppon incoming data.

My question is:
When the reachability has changed (Wifi -> 3G, Wifi -> Other Wifi, etc)
and the app is suspended, can I get some notification in order to reconnect my voip socket?

Thanks.


Solution

  • Answer was both Yes and No:

    • Register to Reachability network changes notifications.
    • If App goes to background suspended while its voip socket (see link) is connected, then uppon network changes app will wake up at background for 10 seconds.
    • If App goes to background suspended while its voip socket is NOT connected, then uppon network changes app will NOT wake up.
    • The solution for the scenario of network loss and going to background with no connection may be fixing the connection in the Keep-Alive block that you can schedule at UIApplication.
    • Note: during the mentioned 10 sec, you may ask for a background task in order to finish the reconnection job.

    Links: