Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I observe the incoming call and outgoing call in background?

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.

like image 272
Saurabh Jain Avatar asked Nov 30 '16 10:11

Saurabh Jain


Video Answer


1 Answers

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

like image 84
Gabrail Avatar answered Sep 27 '22 18:09

Gabrail