Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a phone call AND return to the original app afterwards

Tags:

ios

If I use UIWebView to display a phone number and set the data detector type to UIDataDetectorTypePhoneNumber, then when I click on the number its possible to make a phone call.

After the phone call has ended I am returned back to my app.

However if I attempt to programatically invoke the phone app using

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:123456789"]];

or

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://123456789"]];

Then it is not possible to return back to my app after the call has finished.

Is it possible to be able to programmatically launch the phone app and then return back to my app after the call is finished, the same as if the user clicks on a number in a UIWebView?

like image 790
Gruntcakes Avatar asked Jan 18 '23 03:01

Gruntcakes


1 Answers

Instead of:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://123456789"]];

use:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://123456789"]];

telprompt:// vs. tel://

This will pop up an alert view and the user will have to tap "call" but this returns to the app after the call is done.

like image 136
SirRupertIII Avatar answered May 07 '23 21:05

SirRupertIII