1

I would lie to place a call in my app (I can use the tel:) but I would like to return to my app where I left after the users hangs up. Is that possible?

  • This question answers your question in detail. Simply use a uiwebview to place call instead of openURL: http://stackoverflow.com/questions/5317783/return-to-app-behavior-after-phone-call-different-in-native-code-than-uiwebview – Bushra Shahid Sep 26 '11 at 08:37

3 Answers3

4

I got this code from Apple site and it works perfectly:

-(IBAction) dialNumber:(id)sender{

NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];

NSString *osVersion = [[UIDevice currentDevice] systemVersion];

if ([osVersion floatValue] >= 3.1) { 
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
[webview loadRequest:[NSURLRequest requestWithURL:url]]; 
webview.hidden = YES; 
// Assume we are in a view controller and have access to self.view 
[self.view addSubview:webview]; 
[webview release]; 
} else { 
// On 3.0 and below, dial as usual 
[[UIApplication sharedApplication] openURL: url];
}


}
Dilip Rajkumar
  • 7,006
  • 6
  • 60
  • 76
  • Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as "spammy" by the community. – Kev Aug 09 '11 at 11:39
  • Note that the correct URI is `tel:xxxxx`, _not_ `tel://xxxxx` and AFAIK the later form is now rejected. – DarkDust Aug 16 '14 at 11:51
3

No it's not. The user controls where they navigate after the phone call has ended I'm afraid. by default, it stays in the phone application, and the only way for the user to exit out of it is to hit the home button, which takes them to their main screen. Save your state, and reload it when they come back like everyone else.

jer
  • 20,094
  • 5
  • 45
  • 69
0

You cannot return to the app automatically, after the call completes, but if your app supports iOS 4, its multitasking features (if the app supports them) can bring the user back to the spot where he or she left off before the call, when the app is relaunched.

If you use iOS 3 or earlier, you will need to manually save the app's state yourself and then bring the user back to that state on relaunch.

Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345