Relaunch my application after a phone call made from my application in iphone
I开发者_StackOverflow am making phone call from my iphone application. After the phone call ends i need my application to launch back automatically. Currently after the call ends the application is not lauching. Could anybody help in this issue.
There is no way to do this.
iOS 3 (which you've tagged your post with), there's no support for multitasking; your app doesn't run until it's reopened by the user.
In iOS 4, most apps will be moved to the background, but they're only permitted to do anything in the background for a few limited purposes—completing outstanding tasks that were running, playing music, listening for incoming VoIP calls—and the user will have to reopen the app either in the usual way or by opening the app tray (by double-tapping the home button) and selecting your app.
The primary advantage of the iOS 4 approach for you as an app writer is that you don't have to save or reload user state in your app; the user will return to exactly where they were before the interruption.
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];
}
}
精彩评论