views:

58

answers:

1

Hello,

I Know how to make a call directly from my application programmatically in iPhone, but before invoking the call , my application is terminating, which is not expected to, my application has to resume back, once the call is quit. How to do this for iPhone programmatically?

Thank You.

+1  A: 

See this thread, you can take the code snippet from there as is and use it making a phone call w/o quitting an appication

Keep in mind that it's possible only from iOS 3.1. If you targeting iOS 3.0 there is no way not to quit the application.

NSString *callString = [NSString stringWithFormat:@"tel:%@", @"412-33-44-55"];
NSURL    *url= [NSURL URLWithString:callString];

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

if ([osVersion compare: @"3.1" options: NSNumericSearch] >= NSOrderedSame ) {
    UIWebView *webview = [[UIWebView alloc] initWithFrame:[callButton frame]];
    webview.alpha = 0.0;

    [webview loadRequest:[NSURLRequest requestWithURL:url]];

    // Assume we are in a view controller and have access to self.view
    [self.view insertSubview:webview belowSubview:callButton];
    [webview release];
}
else {
    // On 3.0 and below, dial as usual
    NSString * s = [NSString stringWithFormat:@"tel://%@",@"412-33-44-55"];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:s]];
}
Nava Carmon
hey, wher is this link directed to??after login its going to iPhone developer, Lets discussion begin page :(
VinuthnaS
you need to login with your developer credentials before opening this thread. The snippet is in one of last messages. I can reach the thread after entering my iphone dev credentials. Let me know if you can't get it I'll copy/paste it here, but you cannot try it with simulator, only with device with 3.1 or later installed
Nava Carmon
hi Nava Carmon, i have entered my credentials, its accepted n directing me again to same page.. can u please copy/paste it here...
VinuthnaS
suse
on 3.1 it will not terminate. This because the call is launched from the web view, that is added to your current view. Once the call is finished web view is released and your application is relaunched. I'm afraid it doesn't continue from where it was before. You should save the state before the call and somehow restore it afterwards. I wasn't asked to restore the state of the application after the call, so I didn't try any of these.
Nava Carmon