how to launch default driving directions or map app from another native app

I want to press a button in my native app which will be both android and iphone, and have it launch the default maps/directions app or at least ask the user which app to choose. Is this possible in both android and IOS? If so, could anybody provide a good link? Is it also possible to provide starting and destination parameters? Thanks a bunch.
Who is Participating?
KRUNAL TAILORFreelance Mobile DeveloperCommented:
Hi BobHavertyComh,

You may try something like this for iOS. For iOS you have option of two types maps. one is apple default map and second is Google Map app. For each of to open from your app, this application is require to installed on your device. If not installed it will not work. See URL Refrence for iOS Map:

NSString *mapstr=[[NSString alloc] initWithFormat:@",%f&daddr=%f,%f",starting address latitude,starting address longitude,destination address latitude, destination address longitude];
NSURL *mapurl=[[NSURL alloc] initWithString:mapstr];
[[UIApplication sharedApplication] openURL:mapurl];

Open in new window

Note: All latitude, longitude must be a float value.

For GOOGlE map on ios

Many ref you will get by, Here are some for ios


String uri = String.format(Locale.ENGLISH, ",%f&daddr=%f,%f", sourceLatitude, sourceLongitude, destinationLatitude, destinationLongitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));

Open in new window

Hope this is what you are looking.

Thanks & Regards,
Krunal T. Tailor
BobHavertyComhAuthor Commented:
Thanks Krunal
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.