Setkeepalivetimeout iOS Behavior, Exceeded 15 Wakes in 300 Sec

iOS application runs after end of background task

Resolved.
The cause was improper preparing of tcp connection for background mode.

The right way for me:

  1. Create pair of streams for BSD socket (i use bsd sockets)
  2. Set kCFStreamPropertyShouldCloseNativeSocket to kCFBooleanFalse for both streams
  3. Set kCFStreamNetworkServiceType to kCFStreamNetworkServiceTypeVoIP for both streams

Steps 1) - 3) runs after receiving of first data from server.

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

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:

  • VoIP socket in iOS
  • VoIP socket wakeups - iOS 5 Watchdog

VOIP and background functionality

There is one possible 'hack' which would allow your app to run indefinitely in background. But beware, Apple will reject your app instantly.

Pastebot looped a silent MP3 in the background to keep itself continuously active. You can read more about that process and Apple's rejection of it here.

iOS transfer RTP VoIP call to background

Answer to (1):

iOS VoIP apps may keep a single TCP socket at background, usually your SIP socket, to allow incoming calls (INVITEs).

While your app has an active call, and goes to background, It has no restrictions, you can keep as many sockets as you want.

Here is a more detailed answer from another thread

Regarding the SIP stack implementation, you may want to check open-source PJSip stack



Related Topics



Leave a reply



Submit