osta
osta

Reputation: 29

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 !!!

Upvotes: 0

Views: 890

Answers (3)

Gypsa
Gypsa

Reputation: 11314

Try this

NSString *urlstring=[NSString stringWithFormat:@"http://maps.google.com/?&saddr=%@ &daddr=%@",sourceaddress,destinationaddress];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

Upvotes: 0

Chetan Bhalara
Chetan Bhalara

Reputation: 10344

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];

Upvotes: 1

cweinberger
cweinberger

Reputation: 3588

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!

Upvotes: 0

Related Questions