22

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.

Shekhar Gupta
  • 6,206
  • 3
  • 30
  • 50
Android Killer
  • 18,174
  • 13
  • 67
  • 90
  • Check out these links . http://stackoverflow.com/questions/10054706/how-to-identifying-iphone-incoming-call-and-display-notification http://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/CoreTelephonyFrameworkReference/_index.html – Dunes Buggy Aug 19 '13 at 09:26
  • This answer is no. Please refer: http://stackoverflow.com/a/5395355/907513 – vagase Aug 19 '13 at 09:27
  • As iOS 8 is not out is any way to detect the call events like incoming call, outgoing call even if my app is not in foreground. Or any other new alternatives? – nanospeck Oct 15 '14 at 10:07

1 Answers1

30

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.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • 1
    thanks bro , but is there any way to get incoming call number or name in background state .... ? – Mohit Tomar Apr 23 '14 at 07:25
  • @Mohittomar No this is not possible and would be breach of privacy. – rckoenes Apr 23 '14 at 07:32
  • 2
    So how are they working in this app https://itunes.apple.com/in/app/caller-id-ringtones-hear-who/id317855277?mt=8 – Mohit Tomar Apr 23 '14 at 07:37
  • 2
    My guess would be that they create a custom sound, which they assign the contact as ringtone. – rckoenes Apr 23 '14 at 07:45
  • if we can create a caller id app or can't fetch caller info , so how TrueCaller works ? please suggest. – Mohit Tomar Apr 23 '14 at 08:19
  • is same API can be used for detecting facetime calls as well? – Dinesh Sep 10 '14 at 06:09
  • 1
    We are able to get the information about the incoming call if app is in running mode. But when app goes to background mode it is not working for us. Is it possible in iOS8 without breaking any rules from Apple? – AppAspect May 27 '15 at 07:13
  • 3
    Unfortunately, `CTCallCenter` appears to be completely broken in iOS 9 (built with Xcode 7+) with neither the `currentCalls` property nor the `callEventHandler` working at all. – Beltalowda Jun 08 '16 at 01:57