Is it possible to make a phone call within an iPhone SDK app?

Discussion in 'Mac Programming' started by fenrus110, Apr 10, 2008.

  1. macrumors regular

    Joined:
    Mar 24, 2008
    #1
    I want to be able to touch an icon and have it call a number. It would also be nice if it didn't like interrupt or kill the running app. Is this even possible on the official iPhone SDK?

    I've scoured all possible docs and even looked at the session topics at WWDC, and I see no mention of how to integrate your apps with making phone calls.

    I know it can be done with a tag in Safari, but not sure how that would work since iPhone can only run one app at a time (Safari being one) meaning I would have to kill my app, open Safari, then make the call, but somehow retain the state of my app. And of course, somehow finding a way to make the transition smooth.
     
  2. macrumors member

    Joined:
    Mar 31, 2008
    #2
    Hey SWEET question, i was just wondering this exact same thing.
     
  3. macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #3
    1. It looks like you don't have to go through Safari to use the phone app:
    http://developer.apple.com/iphone/l...ion_1.html#//apple_ref/doc/uid/TP40006513-SW1 (You'll need to be registered to view this link).
    You'll just need a correctly formed url (see the phone link).

    2. This will close your app. But your app needs to be ready to save its state and close at any time anyway (and be capable of restoring state when next launched). This isn't adding any additional burden. Read that whole Programming Guide.
     
  4. macrumors 6502

    Joined:
    Sep 17, 2003
    #4
    I've been wondering this also and came to the same conclusion.

    What I'd like to see is a way to request that an app returns control to you afterwards. So your app closes when you make the call but when the call completes it starts up your app again and returns control. Would make things a lot smoother.
     
  5. macrumors member

    Joined:
    Mar 31, 2008
    #5
    Does UIWebView have the ability to open up phone calls with:
    <a href="tel:1-555-555-5555">1-555-555-5555</a>

    ?????????????
     
  6. macrumors member

    Joined:
    Mar 31, 2008
    #6
    the documentation says it does without the <a href="tel:..></a>

    so just 1-555-555-5555 as text should auto become a phone link.

    its hard to test this on the emulator.

    how do you test that you are clicking on a phone link? nothing seems to happen when i try this out.
     
  7. macrumors member

    Joined:
    Oct 26, 2007
    Location:
    [[NSLocation alloc] initWithCity: Chicago]
    #7
    I think you would need to add a button and have it do the dialing action:

    Code:
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-800-555-1212"]]
    
    Not sure if it works but it gives the same message that you get if you click on a phone number in a contact on the simulator.
     

Share This Page