L
L
Leshich2015-03-03 15:15:51
Objective-C
Leshich, 2015-03-03 15:15:51

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

1 answer(s)
L
Leshich, 2015-03-06
@Leshich

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 question

Ask a Question

731 491 924 answers to any question