Resume application after call through application:
//Call from any button Click
-(void)call{
}
//Call from any button Click
-(void)call{
[self callWithOutExitApplication:[NSString stringWithFormat:@"+%@",@"123456789"]]
}
-(void)callWithOutExitApplication:(NSString *)pPhoneNumber{
NSURL* callURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",pPhoneNumber]];
// Make sure device supports phone functionality.
if([[UIApplication sharedApplication] canOpenURL:callURL]){
if(callURL){
NSString *osVersion = [[UIDevice currentDevice] systemVersion];
if ([osVersion floatValue] >= TEL_OS_VERSION) {
// To resume the application after call is disconnected, initiate the call using the webview (Work around). In this case a confirmation alert will be shown to user.
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[webview loadRequest:[NSURLRequest requestWithURL:callURL]];
webview.hidden = YES;
// Assume we are in a view controller and have access to self.view
[self.view addSubview:webview];
} else {
// On 3.0 and below, dial as usual
[[UIApplication sharedApplication] openURL: callURL];
}
}
}
else{
// If device dose not support the calling feature then show an alert.
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", @"Error")
message:NSLocalizedString(@"NotSupportedFeature", @"Device does not support this feature.")
delegate:nil
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}
Comments
Post a Comment