PDA

View Full Version : Is it possible to make a phone call within an iPhone SDK app?




fenrus110
Apr 10, 2008, 01:42 PM
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.



springframework
Apr 10, 2008, 01:43 PM
Hey SWEET question, i was just wondering this exact same thing.

iSee
Apr 10, 2008, 02:01 PM
1. It looks like you don't have to go through Safari to use the phone app:
http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AppleApplicationsURLSchemes/chapter_950_section_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.

Pring
Apr 10, 2008, 02:06 PM
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.

springframework
Apr 10, 2008, 04:22 PM
Does UIWebView have the ability to open up phone calls with:
<a href="tel:1-555-555-5555">1-555-555-5555</a>

?????????????

springframework
Apr 10, 2008, 05:39 PM
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.

iphoneGuy
Apr 10, 2008, 06:53 PM
I think you would need to add a button and have it do the dialing action:


[[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.