Search code examples
c#xamarin.iosmfmailcomposeviewcontrolleropenurl

Is it possible to go back automatically into the application after calling a Number?


In my application I have some phone numbers, so that the users can call the numbers.

When the users tap the numbers it push them out of the application to call the number they tapped.

What I want is that the application should get the users back to the application after that the conversation is finished.

In Mailing mode you can use MFMailComposeController, and then switch back to the previous view.

So When you use the MFMailComposeController You never get out of the application.

  public override void ViewDidLoad ()
     {
        base.ViewDidLoad ();

    //Call A number</i>
    this.buttonCall.TouchUpInside += delegate {
        NSUrl url = new NSUrl ("tel:0707878039");
        if (UIApplication.SharedApplication.CanOpenUrl (url)) 
        {
            UIApplication.SharedApplication.OpenUrl (url);
        } 
        else 
        {
            Console.WriteLine ("Cannot open url: {0}",url.AbsoluteString);
        } 
    }

So is there a way of doing it?


Solution

  •         this.btnCall.TouchUpInside+= delegate {
    
            UIWebView web = new UIWebView();
                NSUrl url = new NSUrl("tel:07777777777");
    
            web.LoadRequest(new NSUrlRequest(url));
    
    
            };
    

    Works fine, but WebView ask in a (Alert) if you really want to dial the number or not..

    You Can call or Cancel.

    When the call is finished you will get back to the View!

    regards MemoDreamer