I am trying to develop and app that tracks how many minutes are being used for phone calls.
I am trying to get Call events (call received, call ended, etc) in my app. I tried to run the sample code of CoreTelephonyDemo, but I am not getting any call events. I tried this code in applicationWillResignActive but I am not getting any call events.
Below is a sample of what I am working on. Any help/suggestions would be greatly appreciated.
- (void)applicationWillResignActive:(UIApplication *)application
{
CTCallCenter *callCenter1 = [[CTCallCenter alloc] init];
callCenter1.callEventHandler=^(CTCall* call)
{
if (call.callState == CTCallStateDisconnected)
{
NSLog(@"Call has been disconnected");
}
else if (call.callState == CTCallStateConnected)
{
NSLog(@"Call has just been connected");
}
else if(call.callState == CTCallStateConnected)
{
NSLog(@"Call is incoming");
}
else
{
NSLog(@"None of the conditions");
}
};
}