I am new to ios. I was wondering if there is any way to detect the call events like incoming call, outgoing call even if my app is not in foreground. And if yes it is possible then can i read the details about that call like duration, whether it is missed, dialed or recieved. Thanks in advance.
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 you app if you miss 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.