When my application is in the foreground it needs to easily detect the call event like call connected, call disconnected but when my application goes into background it does not detect any call events.
So how can I detect call events like incoming call and outgoing call in background?
I am working on CallKit
framework with iOS 10
and XCode 8
. I found that core telephony framework has been deprecated in iOS 10.
I am using the CXCallObserverDelegate
Pattern for observing the call.
I want to calculate the call duration of incoming and outgoing calls during calling.
After searching about this question i ended up with this answer i think might help
Yes, you can detect a Call, but only if your app is running in the foreground. For this you can use the Core Telephony Framework.
If your app will fall in any of the background running categories (VOIP, AUDIO, Location tracking or accessory ) you might be able to use the
CTCallCenter
in the background. But be aware that Apple will reject your app if you use the background running mode for something it was not meant for.
The CTCallCenter
will allow you to detect any calls that are started or already in progress.
However, you will not be able to detect any detail about the call, the CTCall
identifying the call will only tell you this state. The callID
of CTCall
will just give you an unique identifier for the call but not the number being called.
original question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With