Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to determine if an app is returning from a phone call or resuming from background?
    primarykey
    data
    text
    <p>I make phone call from my application using:</p> <p><code>[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://XXXXXXXXXX"]];</code></p> <p>When the user ends the call, the default Apple-provided Phone app goes to the background and my application resumes focus. This happens automatically. </p> <p>Now here's what I want: <strong>I'd like to call a method every time (and only when) the user returns from a call.</strong></p> <p>I tried calling this method from <code>applicationWillEnterForeground:</code> or <code>applicationDidBecomeActive:</code> but these callbacks are fired at other times when the application is being launched from the background state(which I dont want). </p> <p>I'd like to determine if my application is being launched from the background state or if it is returning from a phone call so I can perform a certain task only in the former case and not latter. Any ideas?</p> <p>----EDIT----</p> <p>Here's how I finally did it:</p> <p>See: <a href="https://stackoverflow.com/questions/13553635/callstatedisconnected-only-detected-for-incoming-calls-not-for-calls-made-from?lq=1">CallStateDisconnected only detected for incoming calls, not for calls made from my app</a></p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self listenForCalls]; } - (void)listenForCalls { self.callCenter = [[CTCallCenter alloc] init]; self.callCenter.callEventHandler = ^(CTCall* myCall) { NSString *call = myCall.callState; if([call isEqualToString:CTCallStateDialing]) { //do ur stuff } }; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload