2

I used CoreTelephony framework introduced in iOS SDK 4.0 to know about Incoming call & its dropped state.

CTTelephonyNetworkInfo *tni = [[CTTelephonyNetworkInfo alloc] init];
    callCenter = [[CTCallCenter alloc] init];
    crtCarrierName = tni.subscriberCellularProvider.carrierName;

    [callCenter setCallEventHandler:^(CTCall *call) {
      if ([[call callState] isEqual:CTCallStateConnected]) {
        //this call has just connected
      } else if ([[call callState] isEqual:CTCallStateDisconnected]) {
        //this call has just ended (dropped/hung up/etc)
      }
    }];

Can i use this event handler to track call state when my app is in background? Can i also fetch incoming call phone number from CTCall object? or there is any other way around.
I dont want to use Private API.Is there way available from Apple iOS SDK?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ritika
  • 593
  • 1
  • 8
  • 21
  • Hi Ritika, can you please tell me did you get this incoming phone number from CTCall or not. Because I ready seen answer here it says not possible but then how TrueCaller app says this number is spam? Apple will approve or not this is the second thing. – Bhavesh Lathigara Jun 02 '16 at 07:24

1 Answers1

2

No there is no way to do this in the official SDK, you can not use it in the background since it does not fall on of the background running categories unless you app does something else in the background then just monitoring the call.

You will never be able to get the phone number of the current call since this is private data Apple will not allow you to acces the data.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • rckoenes: Is it possible with Current SDK(iOS6)? I found some smart watches like metawatch that display the incoming call on the watch. Here is the link. https://itunes.apple.com/us/app/metawatch-manager-for-ios/id557219641?mt=8 – Ram Feb 01 '13 at 13:13
  • The smartwatch use the bluetooth API not an app. so yes they can but you will not be able to do it in an app. – rckoenes Feb 01 '13 at 13:14
  • Can we use it using CoreBluetooth API ?or Do I need to check some other API ? I checked the CoreBluetooth,but unable to find info related to call. – Ram Feb 01 '13 at 13:22
  • No you can't use CoreBluetooth because you will then have to be connecting to the same device which you are trying send the connect request from. It's just not possible. – rckoenes Feb 01 '13 at 13:24
  • Hi rckoenes, Then how TrueCaller app says this number is spam? Apple will approve or not this is the second thing. – Bhavesh Lathigara Jun 02 '16 at 08:24
  • First off TrueCaller does not catch incoming calls, it adds a new group to your contact list. In this group it adds all number know for spam, many 1000 of number will be added. They set a nice user icon for each number which than show up when the number calls you. There is not API to get the incoming number. – rckoenes Jun 02 '16 at 08:31