Reputation: 6267
If I have a phone number somewhere in my application and I want to present the user an option to dial it, can I bring up the phone interface with the phone number automatically typed in dial field and with only green "Call" to press so that phone can dial the number?
How do I achieve this?
Is there any API I should look up?
Upvotes: 3
Views: 1171
Reputation: 9835
I would recommend using telprompt instead of simply tel, as this will pop up with a prompt for the user to decide if they want to call the number, and when the call is done your app will be brought to the foreground after:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"telprompt://%@", phoneNumber]]];
Upvotes: 1
Reputation: 58458
No.
If you present a phone number in your app, you can do so as a URL like tel://1234567890. You can use UIApplication
s openURL:
method to open it.
When a tel:// URL is opened, the system will provide an alert to the user asking them if they wish to dial the number. If they accept, your app will be sent to the background and the Phone app will come to the foreground and the call will start.
I am unclear whether or not your app will come back to the foreground after the call finishes. Hopefully someone can clear that up for me.
Upvotes: 1