SetKeepAliveTimeout iOS, exceeded 15 wakeups in 300 seconds

I am writing a VOIP application on iOS 5, and I am trying to understand how an actual message can stay alive in the background.

I understand that there is a maximum number of awakenings that a socket can receive in a certain amount of time. My problem is that my socket connection receives too many wake-up messages, which is why the application terminates with an alarm message:

exceeded 15 spills in 300 seconds

What I really don’t understand is how should a socket constantly send and receive data through it (for VOIP needs) if there is a limit on the amount of data it can receive in a certain amount of time?

Suppose a socket receives voice data for a voice conversation that occurs in the background. Isn't it that voice data needs to go through a socket connection? If so, how can it work if there is a restriction on the activity that a socket can have in a certain amount of time?

+6
source share
2 answers

VOIP application behavior in the background (iOS 4.0+):

Having a single socket that remains open is marked as Voip. This VOIP connector is supported by the system and the application is suspended on BG. You can schedule a keep-alive block and the OS will wake your application every X times X> = 10min (see [[UIApplication sharedApplication] setKeepAliveTimeout: handler :) this socket is NOT a multimedia socket, it only uses to receive invitations for incoming calls The application wakes up for every incoming data in the socket (iOS 5.0+ limit is 15 times in 300 seconds) After you receive an incoming call, your Appendix wake up, and you can start a conversation with the audio for the call.

VOIP applications should be tagged on info.plist in the “Required Background Modes” section, like “voip” and “audio”.

Once you have opened an audio session (for an active call), your application can work completely in the background and it will no longer be paused until this audio session is closed.

In any case, another alternative is to use push notifications as triggers for incoming calls.
In addition, this eliminates the need to maintain the socket 24/7, save battery power, and will work even if the user closes the application (which does not correspond to the first alternative).

+18
source

What version of iOS are you using?

This is a well-known “feature” / problem that Apple introduced in iOS5 to reduce battery consumption by VoIP applications ...

0
source

Source: https://habr.com/ru/post/905218/


All Articles