Ryan
Ryan

Reputation: 570

Detect user's confirmation of iPhone call link?

The following code, if triggered by a button press in an app, presents the user with a UIAlertView giving them the option to "Cancel", and dismiss the UIAlertView, or "Call" and go through with dialing the number displayed to the user:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://555-555-5555"]];

My question is: Is there a way to detect whether or not the user followed through with actually dialing the number? I am implementing Google "Analytics" in my app to see how users are interacting with it, and I can track when they tap the UIButton that calls the code above, but that doesn't necessarily mean they actually made the call.

Hopefully that makes sense. Thanks in advance for any help!

Upvotes: 0

Views: 378

Answers (1)

Scrungepipes
Scrungepipes

Reputation: 37581

You won't be able to check the user dialed that specific number. But you will be able to check they dialed a number using CTCallCenter:setCallEventHandler:

If they made a call immediately after you present the view its 99.9% reasonable to assume it was that number.

But also your app delegate's willResignActive will get called if they place the call and get connected (I think, I can't remember exactly) so you could use that as an indication.

Upvotes: 3

Related Questions