androidmapsandroid-mapsdirection

How to get the direction for a place in Android


I am creating an Android Application, And I need the direction for a particular place in a string/JSON/XML or any raw format, so I can direct the user to goto the place without leaving my application. I will be very thankful for any answers.


Solution

  • You can achieve that by means on Directions API from Google Maps. I am not sure about your requirements but in general, the steps are the following:

    1. Make a request:

    https://maps.googleapis.com/maps/api/directions/outputFormat?parameters

    1. Specify JSON as your output format.

    https://maps.googleapis.com/maps/api/directions/json?parameters

    1. Supply your request with parameters like origin, destination and your API key:

    https://maps.googleapis.com/maps/api/directions/jsonorigin=Toronto&destination=Montreal&key=YOUR_API_KEY