Search code examples
androidgoogle-maps-api-3driving-directions

Driving direction using google maps API


I have been trying to figure out driving directions using user input and it looks like that functionality has been removed from the google maps API. Is this corrects? I have been searching and have not been able to find any documentation on how to get directions using user input. Does anyone know of any tutorials or documentation on this?


Solution

  • The official documentation contains everything you need:

    1. make a request to retrieve the coordinates related to the user-input: Geocoder.geocode()
    2. Fetch the latlng out of the GeocoderResult
    3. Request the route by using DirectionsService.route() and the given start/endpoint
    4. set the route by using DirectionsRenderer.setDirections()