How can i make phone calls from my application? - iphone

i want to make an application which makes phone calls.i am new in this field.Please give some guide lines.

The URL scheme format (according to the Apple URL Scheme Reference) is tel: NOT tel://. While the latter works now, it is not consistent with Apple's documentation and may not work in the future. Aside from that detail, Noah's and mihirpmehta's suggestions are the correct way to initiate a phone call from within your app. Keep in mind though, that your app will quit when the phone app is launched so you may want to save state before opening the URL.

use
[[UIApplication application] openURL:[NSURL URLWithString:#"tel://8005551212"]];
It will only work in iphone... not in simulator...

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5558675309"]]

Related

How to send my app in foreground after a Facetime (integrated) call?

I'm trying to integrate Facetime in my app so basically what I would like to do is to press a button making a call and when it finishes come back to my app. I know that for the time being there are no public API for Facetime.
What I'm doing at the moment is to use Facetime scheme:
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: #"facetime://"]];
I have two questions:
Is it possible to use in the openURL above the string "facetime://" in order to choose who I want to call in Facetime?! I tried it but what happens is that Facetime is run but without its layout so basically I see myself on the screen but I cannot do nothing.
If not point 1 therefore I use for example "facetime://steve#apple.com" is it possible to come back to my app once the call is finish?! I read about multitasking but I don't know how to manage it in this situation.
Thanks in advance
Alex
To anser your second question, NO just like when your app start a call there is no way to get your app back in the foreground after you close the call.
For your first question, you need to add the contact data (e-mail or phonenumber).
Also be aware that the facetime:// url scheme will work on any iPhone/iPod Touch even if they can't do facetime. If the device does not have facetime support it will just show a blank screen.

Link to iTunes Ratings Page

What's the link to the ratings page on iTunes for my app?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"???"]];
This other question has an appropriate answer. Note that the type=Purple+Software part is literal and not the name of your company. The only thing you need to change is the app id. This example is a little strange in that the string is broken up into several strings, I would just use one for the format to substitute the app id.
The end result looks like this:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=123456789
after iOS7 #Jon Steinmetz link deprecated. so, you should write a code divide os version as follows.
if([[UIDevice currentDevice] systemVersion].floatValue >= 7.0f)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://itunes.apple.com/app/id%#", #YourAppID#]]];
else
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%#&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8", #YourAppID#]]];
Creating a rating link could become a complex issue when supporting multiple OS and multiple platform. For example the WebObjects isn't supported on iOS 7 (some of them), some links you create would open another country store then the user's etc.
There are 2 related open source libraries that could help you:
iLink - There the link would be found at run time (the library would check the app ID and the OS it is running on and would figure out what link should be created). The best point in this is that you don't need to configure nothing before using it so that is error free and would work always. That's great also if you have few targets on same project so you don't have to remember which app ID or link to use. This library also would prompt the user to upgrade the app if there is a new version on the store (this is built in and you turn this off by a simple flag).
Copy the 2 library files to your project.
On your appDelegate.m:
#import "iLink.h"
+ (void)initialize
{
//configure iLink
[iLink sharedInstance].globalPromptForUpdate = YES; // If you want iLink to prompt user to update when the app is old.
}
and on the place you want to open the rating page for example just use:
[[iLink sharedInstance] openRatingsPageInAppStore];
and import iLink.h on the same file.
There is a very good doc for the whole library there and an example projects for iPhone and for Mac.
iRate - This library is super recommended if you want the library to prompt the user rating process automatically. Just set the parameters you want and it would do the work for you (also have translations for lots of languages). The downside is that you would use an alert view for that and not your own UI.

iPhone Linking to an iTunes page

I found a page (http://itunes.apple.com/linkmaker) to get the iTunes url for a specific page which I assume should direct the user out of my app and into the corresponding page in the app store.
I have never done this or any other UIWebView stuff but after some searching I found some code that I thought would work that uses UIApplication.h.
My code is:
#import <UIApplication.h>
//...in a tableView....
case 8:
- (BOOL)openURL:(NSURL *) http://itunes.apple.com/us/app/lockbox-pro/id288460603?mt=8&uo=4;
break;
openURL has an error saying that it is undeclared - but I imported the UIApplication.h file. Then I saw that the UIApplication import also had an error on it. I don't think that I want to use UIWebView because from what I understand, that opens up the URL in the app itself - I want to direct the user to the App Store. Where am I going wrong?
EDIT: Okay, I changed it to a simple button that is supposed to close the app and bring the user to the itunes page:
- (IBAction) pressedFull {
[[UIApplication sharedApplication] openURL:[NSURL urlWithString:#"http://www.google.com"]];
}
I linked it in IB - it still crashes the app when the user clicks on it.
Your code has a number of things wrong in just one line. First, you're typing the method signature rather than using the method properly (ie, sending a message to an object). Second, you're not enclosing the string.
Try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://yoururlhere"]];
With respect, you should review the Learning Objective-C: a Primer thoroughly until you are more comfortable with the syntax as well. A quick look at some of your other questions suggests this is your biggest issue. You'll be doing yourself a huge favor by setting all else aside and concentrating on getting Objective-C well and truly under your belt before continuing.

How to find a call is unanswered in iphone

If i make a call from an application using
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://1234567890"]];
How can i check if the call is answered or unanswered
Thanks,
You cannot check this. When this URL is opened your application will be closed and phone app will be launched. Since you cannot access calls data from your app there is little you can do. This may be possible in jailbroken iPhone.
Pop up a dialog when the app re-opens asking the user if the call went through. You better have a good reason for wanting to know though or the user will be mighty annoyed!
Otherwise you are out of luck.
Not an iPhone app developer but is it possible to query the phone log the next time the app loads and check time on call or something and if it is over 20 seconds consider it completed or something like this?
There is no access to the iPhone phone from third party software. Luckily.
you can reffer
How can I check missed call in iPhone using Objective-C?

iphone emulator URL schema for phone call

I'm new to iPhone dev. I could solve most of my problem reading stackoverflow/apple doc, but now I'm kind of stuck.
I'm trying to make a phone call from a phone number.
from the doc and example I found, I made this:
// "9312345678"
-(void) doCall:(NSString*) phoneNumber{
DsLog(phoneNumber);
NSString * s = [NSString stringWithFormat:#"tel:%#",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:s]];
}
This do nothing ! (no exception, no dialgo, no phone call)
Did I did something wrong? Is it because it's the emulator?
any help appreciated,
Loda
PS: I got something similar to open the browser, and it's working fine; The log show in the debugger console with a valide phone number.
btw its tel:// not tel:
But it does not work in the simulator.
If you want to see what handlers work, you can open up the simulator and safari (within the simulator) and then try it out. You can also do it from a real phone.