My application is primarily a client for a server that does not actually have an Internet connection. It connects to the Polycom codec and manages video calls between two endpoints. This way, my application can send commands like end call, volume, etc ... However, this is my problem. I need some kind of notification when an incoming call occurs and the application is not in the foreground. Since the server does not have access to the Internet, APNS / push notifications will not work for me. I looked at something like. It seems that my client is working, but I cannot make a warning since my application is in the background.
So, besides fixing my problem, my questions are:
Can I bring my application to the forefront using the technique indicated in the link (something like what I'm doing below). From the logs you can see that this code supports my code. I know that my while loop is wrong, and in the end I will need KVO, but no matter what should not affect the answer. (one thing I don’t understand is that my whole application is working, and not just the class that I have bcClient in there?)
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[bcClient connect];
bgTask = [app beginBackgroundTaskWithExpirationHandler:expirationHandler];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
while(1) {
sleep(3);
NSLog(@"held join %d",bcClient.heldjoin);
if (bcClient.heldjoin == 602 || bcClient.heldjoin == 604 || bcClient.heldjoin == 513) {
NSLog(@"incoming call");
}
}
});
}
If I cannot bring my application to the forefront, is there a way to send a notification locally (without the need for an APNS server)?
I have a feeling that this is impossible, but I decided that I would ask.
source
share