Finding driving directions using Google Maps JavaScript API V3

5.4k Views Asked by At

Here is the scenario that i want take two addresses dynamically from user, consider one of them as source and other as destination and find driving directions between source and destination.

i googled and got some stuffs not familiar to me..such as writing script using Google Maps JavaScript API V3, and the direction out put will be in json or xml format...i have tried google.map.directionrenrender and directionservice api's in my code but it is saying no such classes in google.map..as i am new to scripting language i am not understanding how to start ....i am using eclipse ide, where i want to build an android app that takes addresses and gives driving directions between those two points..

i want the program almost similar to this Google map driving direction source code for their example? but here they have used some html code and why that is actually required..?

please help me in writing the code

Thanks in advance

1

There are 1 best solutions below

1
On

To open up Google Maps with directions, start a new Intent using a URL like this:

http://maps.google.com/maps?saddr=%s&daddr=%s

Replace each %s with a string like "x,y" where x and y specify the latitude and longitude. If you want directions from the current location, leave the saddre parameter blank.

This won't work on phones that don't have Google Maps installed, and in those cases will open the browser.