D
D
Dima Yarmolchuk2012-12-12 00:39:03
iOS
Dima Yarmolchuk, 2012-12-12 00:39:03

VoIP socket for ios app?

There is an application that works in the background, I created a socket through a lib , I clearly let it know that it should work in the background, Everything should be fine, but after 15 minutes of work in the background, the socket is killed :(

Who has come across what can be done to make the socket did not close and continued to work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Yarmolchuk, 2012-12-14
@yarmolchuk

- (void)backgroundHandler { NSLog(@"### -->VOIP backgrounding callback"); UIApplication* app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }]; } - (void)applicationDidEnterBackground:(UIApplication *)application { BOOL backgroundAccepted = [[UIApplication sharedApplication] setKeepAliveTimeout:600 handler:^{ [self backgroundHandler]; }]; if (backgroundAccepted) { NSLog(@"VOIP backgrounding accepted"); } UIApplication* app = [UIApplication sharedApplication]; bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ [app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid; }]; }
I found a solution to the problem, added such code to the appDelegate and everything is working fine now in the background. There are few places where you can find a description of this.

A
a_dobkin, 2012-12-12
@a_dobkin

Have you registered applications like VoIP applications?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question