开发者

Launch an application after the call ends

I am developing an application in which, I can initialize a call from the application.开发者_如何学C Is it possible to come back to the same place in the application where I was before the call, after the call is terminated? If it is possible, then how? Thank you in advance.


I believe you can not do what you are trying to do. Because once the user attends the call and terminates the call, the application currently active would be Dialer and you can not in no way make you application active.


Implement the following methods from the UIApplicationDelegate protocol:

applicationWillResignActive is called when the phone receives an incoming call

applicationWillTerminate is called when the user answers the call

applicationDidBecomeActive is called if the user choose not to answer the call

applicationWillTerminate will give a few seconds to save your apps current state.

Use NSUserDefaults to save state . When the app starts again you read your state from NSUserDefaults and restore the app to its previous state.


If you want to come back to your application after a phone call, need to change

[UIApplication sharedApplication] openURL:telURL];

to

UIWebView PhoneCallWebView = [[UIWebView alloc] init];
[PhoneCallWebView loadRequest:[NSURLRequest requestWithURL:telURL]];

and it works.


I hope this will help you...and this will back after in application after call ended.

NSString *aPhoneNo = @"9876543210";
    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];
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜