0

I am using Xamarin.Essentials Phone Dialer in my xamarin forms app to make calls. In android when we click call it will directly open dialer. In ios when we click call it will firstly show a alert box that will ask Call or cancel. Is it possible to open the dialer in ios without showing the popup? If it is not possible can we get the alert box cancel or call click event?

enter image description here

Anand
  • 1,866
  • 3
  • 26
  • 49
  • That is native ios behaviour and i do not think that can be changed. But lemme see if I can find something – FreakyAli Oct 17 '19 at 05:25
  • @FreakyAli That will be a great help bro – Anand Oct 17 '19 at 05:26
  • 1
    Possible duplicate of [Prompt when trying to dial a phone number using tel:// scheme on iOS 10.3](https://stackoverflow.com/questions/43121740/prompt-when-trying-to-dial-a-phone-number-using-tel-scheme-on-ios-10-3) – FreakyAli Oct 17 '19 at 05:57
  • @FreakyAli I saw that question, so thats why I asked to get the cancel or call button click event – Anand Oct 17 '19 at 05:58
  • You cannot get that either what exactly are you trying to achieve anyway? – FreakyAli Oct 17 '19 at 07:39
  • @Iam trying to show a popup if user placed the call. The popup intitialised after the call button click.But I want it to be show only when call placed. Not when the user clicked the cancel button – Anand Oct 17 '19 at 07:41

2 Answers2

0

Unfortunately, this is not possible in iOS.

From Apple's documentation:

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.

For security reasons, iOS requires users to confirm they want to perform the call before dialing in.

pinedax
  • 9,246
  • 2
  • 23
  • 30
  • Ok . Is it possible to get the cancel and call button event? – Anand Oct 17 '19 at 05:51
  • No, this is a system dialog and there's not any callback or event to subscribe to. A simple way to figure out if the user went to dialer (hit on Call) would be by subscribing to the app event when the app is going to background. This is just an idea. – pinedax Oct 17 '19 at 05:57
0

Is it possible to open the dialer in ios without showing the popup?

No, it is by design.

can we get the alert box cancel or call click event

You have to detect the state of phone call by yourself in the iOS project, you can write below codes in the AppDelegate:

    CXCallObserver callObserver = new CXCallObserver();
    callObserver.SetDelegate(new myDelegate(), DispatchQueue.MainQueue);

And in the delegate, you can check the call state:

  public class myDelegate : ICXCallObserverDelegate
    {
        public IntPtr Handle => throw new NotImplementedException();

        public void CallChanged(CXCallObserver callObserver, CXCall call)
        {
            if (call.Outgoing==true && call.HasConnected ==false)
            {
                Console.WriteLine("Dialing");
                //use Messaging Center to send the state to Xamarin.forms Project.
            }

            if (call.Outgoing ==false && call.HasConnected == false)
            {
                Console.WriteLine("disconnect");
                //use Messaging Center to send the state to Xamarin.forms Project.
            }
            //you can use other state to check the state...
            //call.OnHold; call.HasEnded;

        }

        public void Dispose()
        {
        }
    }
nevermore
  • 15,432
  • 1
  • 12
  • 30