Calling Card Integration in iPhone - iphone

I need to develop an application to integrate calling card functionality. The application will have an access number, a country code and a pin number setting.
When a user wants to make a call the system should dial the access number and then after a time interval it should dial the country code and finally pin number followed by the actual telephone number.
How would one implement this?

Might work, haven't tried it. Won't work in simulator. Real answer s/b close
UIApplication *app = [UIApplication sharedApplication];
NSString *urlString = [NSString stringWithFormat:#"te1://12125551212,,,%#,,,%#", numLang, numPin];
NSURL *url = [NSURL URLWithString:urlString];
[app openURL:url];
Comma are pauses.

Related

Using Dialer for iOS app [duplicate]

I allow my user to select phone numbers in my application. How can I then bring up the iPhone call screen and then if possible, initiate the phone call?
You'll have to recreate the dial screen within your application (didn't take too long for me to do.) Once you have the phone number entered, you'll need to initiate the phone call by doing:
NSString* theNumberYouGathered = #"9994441234";
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: [NSString stringWithFormatting: #"tel:%s", theNumberYouGathered]]];
Note this will only work on the actual phone, and not the simulator.
To create the dialer screen you'll need to:
Create a xib file with a set of UIButtons (for #s 1-9), a UILabel to show the currently entered number, and a "Call" button.
Hook up the presses on the number UIButtons and add the digit to a local variable NSString on your ViewController. Update the UILabel with this number.
When the call UIButton is pressed, take the locally stored # and place the aforementioned method call with it.
You can do this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:12125551212"]];
which will create a UIAlertView prompting the user to call the number or cancel.
You can use below code
NSString *phoneNumber = #"18000275749"; // dynamically assigned
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"telprompt://%#",phoneNumber]]];

Make a Call from UITableViewCell

I stuck with a problem.
In my tableView I got a cell with a phone number. I would like to click on the phone number and make a call.
I implemented the following in didSelectRowAtIndexPath:
NSString *cifra=#"tel://123456789";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:cifra]];
NSLog(#"after call %#",cifra);
Unfortunatly it doesnt do anything. In my log it shows me my "after call ... " but it is not calling. No error, no log, no action :(
It works for me with opening a website or googleMaps, but not for calling.
Is there anything i can do?
Maybe a it is simple answer, but i really dont know what to do. Is there a different way to make a call?
I am using the iPhone Simulator. Is this the problem? But it should do a thing, shouldn't it? :)
Thanks for your help!
You can't make calls from the Simulator.
If you want to test making a phone call, run the app on your device, then press the cell to make a phone call on your actual device.
You can simulate the in-call status bar, but there is nothing actually happening when it comes to actual phone calls.
Hardware > Toggle In-Call Status Bar
Note that using [[UIApplication sharedApplication] openURL:SOMEPHONENUMBER]; does not trigger this event.
Tried this code to make a call
NSString *prefix = (#"tel://(972)818-32432");
UIApplication *app = [UIApplication sharedApplication];
NSString *dialThis = [NSString stringWithFormat:#"%#", prefix];
NSURL *url = [NSURL URLWithString:dialThis];
[app openURL:url];
On top of the answers mentioning you can't make calls from the simulator, cifra should be #"tel:123456789", the double slashes aren't needed.

Google map Implementation in Iphone

I already implemented google mapping functionality in my iphone application.It works fine but if the location to search is wrong string then it maps a location and it redirects to current location only after the search button clicks. How to implement that if the location is wrong then directly go to the current location? My code is like below
NSString *urlString = [[NSString stringWithFormat:#"http://maps.google.com/maps?z=14&q=%#",message] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
please give me a solution as soon as possible
Thanks in advance
Since you lose control the moment you leave your app, you should always perform the validity check before opening the URL by passing message to a CLGeocoder or a 3rd party Geocoder .
CLGeocoder Class Reference
Basically query for the location string inside your app, then format your url accordingly.

Iphone: how to launch a route in google maps api from your application

I have read a lot of topics, but i don't find when i want
I want to launch google map api from my application with that:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"]]
But it's open safari with Google maps page. I want open Google map API with my route. There is a maps:// or other things?
Thanks for help !!!
Try this
UIApplication *app = [UIApplication sharedApplication];
NSURL *url = [[NSURL alloc] initWithString: #"http://maps.google.com/maps?saddr=41.029598,28.972985&daddr=41.033586,28.984546"];
[app openURL:url];
[url release];
have a look at the Apple URL Scheme Reference for MapLinks
Edit: your URL looks correct. Looks like you are testing on Simulator! GoogleMaps app is only available on device!
Try this
NSString *urlstring=[NSString stringWithFormat:#"http://maps.google.com/?&saddr=%# &daddr=%#",sourceaddress,destinationaddress];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

SMS body in iphone SDK

I need to send an SMS from my iphone app. the body of the SMS is created programatically. so when i tap on a button the SMS application should get opened with my message pre-typed in it. anybody knows how to do it? need help
Thanks in advance.
Shibin
You can't set the SMS body. The only things you can do from your code, as per the official SDK, is 1) to open the SMS application:
NSString *stringURL = #"sms:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
and 2) to set the phone number for a new message:
NSString *stringURL = #"sms:+12345678901";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
You can set the body in iOS 4. Please cf the documentation.