6

is it possible to generate a call or an sms from an application that we create for iphone? Also is it possible to record a call???

Nithin
  • 6,435
  • 5
  • 43
  • 56

2 Answers2

11

See the Apple URL Scheme Reference. What you want is:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:1-305-555-1212"]];

and

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:1-305-555-1212"]];

Unfortunately, there is currently no way to specify the text of an SMS.

As for recording calls, take a look at the Recording Audio section of the Audio Queue Services Programming Guide. I'm not sure if this functionality is disabled when a phone call is taking place, and at the very least you will have to open the application to record the audio (i.e., you won't be able to automatically record the audio). You should also look into the legality of recording phone calls and any consent requirements for the areas you wish to use/offer your application.

Martin Gordon
  • 36,329
  • 7
  • 58
  • 54
  • are you sure that we can generate calls form the application legally?? or this code is for jailbroken phones?? – Nithin Jan 01 '10 at 07:30
  • 2
    @Nithin: plenty of apps in the app store can generate phone calls. See one of the dozens of restaurant review apps for an example. – Michael Petrotta Jan 01 '10 at 07:35
  • can we test this in a simulator? – Nithin Jan 01 '10 at 08:52
  • 2
    You won't be able to test in the simulator as it neither has the Phone or SMS apps. If you try it, you will get an alert notifying you of the fact, as stated in the first linked page. – Martin Gordon Jan 01 '10 at 09:19
  • 2
    I second that you can generate calls, I do it in my app. It does nothing in simulator, so test it on actual device. – bentford Jan 01 '10 at 10:34
  • Make sure to remove spaces from the number if there are any. – tidbeck Jan 17 '13 at 22:05
0

Is it possible to get back to our app, once the call is made and completed and can we use the app from the stage where we went for call?

@Krishna : This happens by default , if you are working on your app and you get a call your app pauses, after the call is dismissed the application will be resumed.

RVN
  • 4,157
  • 5
  • 32
  • 35
  • Note that you can't rely on this - if the user launches another app while on the call, or even presses the Home button, your app won't automatically be opened. Also, I don't believe you can differentiate between resuming because a call ended or because a user tapped your app again. – Tim Aug 20 '11 at 22:03