im trying to make a call through the telpromt command:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt://123456789"]];
The problem is, that when de code is run, it displays an UIAlertView not of my property, asking to confirm the call.
It has to buttons: Cancel and Call.
I want to programatically press the call button in the AlertView.
Is it possible ?
Thanks !
iOS does this to protect the user from malicious applications which would try to make random calls. Anytime there are integrations to the phone, SMS, twitter, facebook, etc. apple requires the user to accept and allow the application to perform the action. This is why the iPhone displays a UIAlertView asking the user wether they really want to make a call to the phone number you're providing.
Related
This question already has answers here:
Prompt when trying to dial a phone number using tel:// scheme on iOS 10.3
(2 answers)
Closed 5 years ago.
My current enterprise iOS app includes an emergency 911 call feature for our guys in the field who often work under potentially unsafe conditions. The idea was that in case of a medical emergency, they could tap the "Dial 911" button and the phone would just dial.
In order to prevent a mistaken call, the user has a 10 second grace period to cancel the call, at the end of which the system will place the call. But in the unusual and extreme case where the user may be seriously incapacitated and unable to respond further, the call should go on through after the ten second gap.
I had all that working before the latest iOS update. Once the user tapped the "Call 911" button, the phone would complete the call without having to confirm. But now since the latest update, the phone has started showing a confirmation alert anyway.
Here's the line of code that I had been using which, until now worked fine:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"tel:%#",strEmergencyNumber]]];
The trick apparently being to use the tel: command.
I'm wondering if there is any other way to make the phone skip the confirmation alert. Otherwise, this may be a worthless function, with potentially fatal results.
Not trying to sound dramatic, but that's just the way it is. Ours is a sometimes-very dangerous business.
Thanks!
Unfortunately, what you desire to do is not possible, at least in the existing versions of iOS. That dialog will always show.
Per Apple's documentation for openURL:
When a third party application invokes openURL: on a tel://,
facetime://, or facetime-audio:// URL, iOS displays a prompt and
requires user confirmation before dialing.
I'm trying to begin a phone call from within my iPhone app (similar to several other questions already answered on SO), but with a specific wrinkle: my boss doesn't want the call to begin immediately. He wants the app to open the Phone app and autofill the number, but require the user to actually press the green button to begin the call.
Is this possible? All the research I've been doing has followed the...
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://911"]];
...pattern, which begins the call automatically as soon as it switches over.
Is it possible to prep the call and autofill the number, but not actually begin the call automatically?
as far as i know that is not possible. one thing you could do is for example present an alert and ask the user explicitly if he / she wants to make the call.
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!
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.
I have the following problem, I would like to know if there is something implemented by facebook or if you know a workflow to avoid this issue.
Basically I use facebook SDK to login, the app send me to the browser, and instead of clicking cancel or Accept/OK, I click home button and get back to the app.
In that case I don't receive any callback from facebook SDK.
Also, facebook have a delay when you click cancel or ok button, so when you get back to the app you don't know exactly if you are going to receive the callback or not by 2-3 seconds aprox.
My current solution is giving a delay of 3-4 seconds and check if you are already connected or not, and show the buttons again if you are not connected. It's a really bad approach, but I can't find something better for that.
You're supposed to handle this in your AppDelegate's applicationDidBecomeActive method:
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Handles activation with regards to returning from iOS 6.0 authorization dialog or from fast app switching
[FBSession.activeSession handleDidBecomeActive];
}
Docs here: https://developers.facebook.com/docs/reference/ios/current/class/FBSession/#handleDidBecomeActive
and
https://developers.facebook.com/docs/ios/ios-sdk-tutorial/authenticate/
My app allows the user to make a phone call but I need to hide the number I'm calling to because it has a secret code within it. Is there any way to achieve this?
When I say "hide the number", I mean the phone number that appears in the the confirmation UIAlertView before calling and, if possible, in navigation bar when the call is in process.
Most definitely not. The phone number that gets passed to the OS when making the call cannot be modified or hidden from the user. (What if your app dialed 911?)
Also, how is a "secret code" passed via a telephone number?
Are you using the native phone number recognition code within a web view, or is this a custom button in your app.
In an app I've created, I have a button that the user can tap to call a phone number. This button presents a UIAlertView that I create myself (and therefore have complete control over what it says), and then in the alertView:didClickButtonAtIndex: delegate method, I do:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5555555555"]];
to initiate the call.
I think if you try to modify the way how ios Phone app works, your app might be rejected. I'm almost sure they will not happy to let your app dail a number without user's knowledge.