background app in iOS that detects incoming phone calls

2 Solutions Collect From Internet About “background app in iOS that detects incoming phone calls”

This would be very much against Apple’s privacy policy and there’s no chance an app like this would be approved.

There are call recording apps that sneak around this restriction, though, but they use third party services and no actual built-in iPhone API’s.

You can do it in applicationWillEnterForeground using CTCallCenter’s CTCallState properties. Don’t forget to import the CoreTelephony framework. Here’s an example:

#import <CoreTelephony/CTCall.h>
#import <CoreTelephony/CTCallCenter.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>

- (void)applicationWillEnterForeground:(UIApplication *)application
    [callCenter setCallEventHandler:^(CTCall *call) {
        if ([[call callState] isEqual:CTCallStateIncoming] || [[call callState] isEqual:CTCallStateDialing]) {

            if ([viewController isPlaying])
                NSLog(@"Call was started.");
        } else if ([[call callState] isEqual:CTCallStateDisconnected]) {
            if (callWasStarted)
               NSLog(@"Call was ended.");