Daniel V Daniel V - 1 year ago 299
iOS Question

CTCallCenter - Call Event Handler - in background state

Regarding the Apple documentation there is no way to handle the phone state while the app is suspended :

"While it is suspended, your application does not receive call events"

Is this also true for the "background" state? (As the background state is not the same with the "suspended" app state regarding the states described in the Apple documentation)


I'm handling the phone state using the following code :

CTCallCenter *callCenter = [[CTCallCenter alloc] init];

callCenter.callEventHandler=^(CTCall* call)

//call state


I have added a local notifications into the callEventHandler block in order to check if a call events will be received while my app is in background state but is seams that the block is not executed ( my app has a background support and all received events (via TCP) are handled correctly while the app is in background )

Any help is appreciated!


Answer Source

All tests that I've done I can't receive any using callEventHandler when the application is in background. But, when the application is in foreground, all nicely work.

The socket works, because iOS handles it for you app and deliver the packtes accordingly. But for that, you need to create a voip socket and add voip to UIBackgroundModes to your App-Info.plist.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download