Reputation: 11
How can we make phone calls programmatically without using the code
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://9423456789"]];
Upvotes: 0
Views: 1082
Reputation: 568
@Prasanth T R
But the my app is switching to the Phone app and it's cannot turn back to my app after ending the call. I need the call to be made within my app
To go back to your app, use telprompt://9423456789 instead of tel://9423456789
using "telprompt://" when a call finish the user will go back to your app
NSString *phoneDigits = @"9423456789";
NSString *phoneNumber = [NSString stringWithFormat@"telprompt://%@",phoneDigits];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]]
Upvotes: 0
Reputation: 21
So do this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://9423456789"]];
Then create a local notification that pops up in 1 seconds to bring the user back to your app.
Upvotes: 1
Reputation: 16193
The only way to make a call completely within your own application is to create your own VoIP-like solution. You can't make cellular phone calls within your own app.
It's completely user-controllable and, just like sending SMS and email, should stay that way. There were too many applications for Windows Mobile for example, which would send premium SMS behind user's back.
Upvotes: 0
Reputation: 54425
The method you've suggested is the only means of programmatically requesting that a call is placed.
If you're attempting to subvert the user's acceptance of the call, then this isn't possible using the public APIs.
Upvotes: 4