开发者

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";
  [[UIAppl开发者_StackOverflow中文版ication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

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


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


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.


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


From iOS 5, use below...

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


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]];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜