I would like to know if there is a possibility to detect if the user is in call from an application that is currently in background.
Or, receive a notification when the call is ended if the call was initiated from my app.
Or, even more than that – is there a possibility to detect which app is in foreground?
I don’t believe that this is possible but I had to try… 😉
Any info will be appreciated.
Thank you.
In
CTCallCenter, there is a method,callEventHandlerthat you can pass a block that will get called when call events happen. In this block, you’ll be passed aCTCallobject, and can get thecallState. So, you can get a notification when a call is initiated or ended, and handle it appropriately. You can’t get which application initiated the call, but if you set an ivar when you make the call, you can tell that it’s your application that made the call.For example:
EDIT: Re-reading your question, you want these events while you are suspended, correct? I don’t think that’s possible.
From the docs: