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.
LVL 9
BobHavertyComhAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KRUNAL TAILORFreelance Mobile DeveloperCommented:
Hi BobHavertyComh,

FOR IOS
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: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

NSString *mapstr=[[NSString alloc] initWithFormat:@"http://maps.apple.com/maps?saddr=%f,%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
http://googlegeodevelopers.blogspot.in/2015/03/open-google-maps-from-your-ios-app.html

Many ref you will get by, Here are some for ios
1) http://www.reigndesign.com/blog/how-to-launch-google-maps-or-apple-maps-from-an-ios-app/
2) https://github.com/googlemaps/OpenInGoogleMaps-iOS

FOR ANDROID

String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", sourceLatitude, sourceLongitude, destinationLatitude, destinationLongitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

Open in new window


Hope this is what you are looking.

Thanks & Regards,
Krunal T. Tailor
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BobHavertyComhAuthor Commented:
Thanks Krunal
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Android

From novice to tech pro — start learning today.