I have seen this question before but without any real answer.
I am using the following code to start a phone call in objective-c.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt:1234567890"]]
This code opens a dialog with the telephone number, an Abort button and a Call button.
Does anyone know how to detect if the Cancel button was pressed?
I need to do some special arrangements in app if Cancel is pressed.
I have tried to use a UIAlertView
combined with the @"tel:1234567890"
command, but that isn't any good. If the "tel:"
command is used, the user will leave the app which isn't what I want...
Thanks!
/Henrik
I think is possible to make guess which button user selected in call prompt.
After you call openURL:
your app receive [AppDelegate applicationWillResignActive:]
method call.
Then possible two cases:
If user select Call you get [AppDelegate applicationDidEnterBackground:]
because phone app will open.
If user select Cancel you get [AppDelegate applicationDidBecomeActive:]
method call.
I think you can implement some singleton to save app state and update it in this methods.
Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With