Answer the question
In order to leave comments, you need to log in
How can I check the incoming call when the iOS application is in the background?
I need to process a call in an application. I check the incoming call in applicationWillResignActive with if(CTCallCenter().currentCalls != nil)
This works if the call interrupts the application.
But I would also like it to work when the application is running in the background. Is it realistic to do it? It turns out that I have to check for changes in this particular currentCalls variable all the time the application is running. Tried to use stackoverflow answers but nothing helped - no semaphores, no waiting on a thread. Can anyone help figure it out?
Answer the question
In order to leave comments, you need to log in
If anyone is interested, I coped with the task)
You just had to use callEventHandler, it is able to respond to the call event and output. But how to sit in the background is a completely different question)
let callCenter = CTCallCenter()
func callEvent (call:CTCall!) {
println("Got into callEvent")
if (call.callState == CTCallStateConnected) { println("Connected") }
else if (call.callState == CTCallStateDialing) { println("Dialing") }
else if (call.callState == CTCallStateDisconnected) {println("Disconnected")}
else if (call.callState == CTCallStateIncoming) {println("Incoming call")}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question