Reputation: 289
I am checking it with
- (void)applicationWillEnterForeground:(UIApplication *)application
when it comes back to the app.
But this one doesn't detect when the user declines the call. Is there anyway to detect even when the user declines the call?
Upvotes: 1
Views: 840
Reputation: 162
I think what you want is to detect when the app is coming back into an active state. There are two delegate methods for this:
applicationWillEnterForeground: Tells the delegate that the application is about to enter the foreground.
- (void)applicationWillEnterForeground:(UIApplication *)application
and
applicationDidBecomeActive: Tells the delegate that the application has become active.
- (void)applicationDidBecomeActive:(UIApplication *)application
more info in the documentation of UIApplicationDelegate
Upvotes: 1
Reputation: 3368
Maybe you could use the following notifications, in your case, the second one:
Add CoreTelephony.framework
to your project and:
#import <CoreTelephony/CTCall.h>
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callReceived:) name:CTCallStateIncoming object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callEnded:) name:CTCallStateDisconnected object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(callConnected:) name:CTCallStateConnected object:nil];
Upvotes: 4
Reputation: 1605
There isn't a way that I know of to tell when the call is declined. But this method is called when the user gets a call:
- (void)applicationWillResignActive:(UIApplication *)application {
}
Upvotes: 0