1

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?

MemoDreamer
  • 103
  • 8
  • Please clean up either the code.. the explanation or both.. sounds like you will need a process that will check if the status of the call is complete and if so return that status back to the application.. also add some cleanup / dispose code / null of references in your code as well.. – MethodMan Feb 13 '12 at 16:36

2 Answers2

2
        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

MemoDreamer
  • 103
  • 8
0

No. You are passing control to an external application (the phone App), and there is currently no way to tell it to switch back to your app.

Jason
  • 86,222
  • 15
  • 131
  • 146
  • 1
    I received another response from another person, and he wrote: use a hidden UIWebView and navigate to the number using tel:... If you use webview, you will be redirected back to your app, after the call has ended.. But webview aks if you really want to dial the number.. So there is a way to do it, I will try to make it work, and if I do I will post the answer. regards – MemoDreamer Feb 14 '12 at 12:36
  • In my experience this doesn't work. However, if you figure it out I'd be very interested in finding out how you did it. – Jason Feb 14 '12 at 12:50
  • 1
    -1 for claiming there's no solution when in fact there was one! – Niels Bosma Feb 16 '12 at 11:58