user601367
user601367

Reputation: 2368

How to return to my iphone application after call ends?

I am able to call from my iphone application by using below code:

  NSString *phoneNumber = @"tel://1234567890";
  [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

Now, i want to know how to return to my application back when the call ends ?

Upvotes: 0

Views: 1686

Answers (5)

nilam_mande
nilam_mande

Reputation: 931

Just use telprompt:// instead of tel://

telprompt will prompt the user first, and when call ends,it will go back to your application.

NSString *myNumber = [@"telprompt://" stringByAppendingString:txtMobileNo.titleLabel.text]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:myNumber]];

Upvotes: 0

Fahim Parkar
Fahim Parkar

Reputation: 31637

From iOS 5, use below...

NSString *phoneNumber = [@"telprompt://" stringByAppendingString:@"12345678"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

Upvotes: 0

    UIWebView *phoneCallWebview = [[UIWebView alloc] init];
   // [self.view addSubview:phoneCallWebview];
    NSURL *callURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", 9238928399]];
    [phoneCallWebview loadRequest:[NSURLRequest requestWithURL:callURL ]];

Upvotes: 2

JeremyWeir
JeremyWeir

Reputation: 24368

I found this SO question

End call, don't return to app automatic in iphone 3.1 version

Which pointed to an article on apple dev forums

https://devforums.apple.com/message/128046 (dev account required)

Which says it was a change in iOS 3.1 but a "workaround" is

use UIWebView to open the tel: url, after the call, your app will relaunch, but you get the annoying do you want to make this call alert.

I have't verified this works as described, just thought I'd point it out

Upvotes: 0

J. Steen
J. Steen

Reputation: 15578

As far as I'm aware, such interaction is impossible since your application has been demoted to background, and all UI interaction has been delegated to the Phone app, and the user.

Upvotes: 1

Related Questions