I am using Google's JAVA client API to get the route and i am sending the request like this,
DirectionsRoute[] routes = DirectionsApi.newRequest(context)
.mode(TravelMode.DRIVING)
.origin(start).destination(end)
.waypoints(wayPoints).await();
It is returning route also but if i plot that route it is not plotting on actual route instead it just takes straight line as shown in image.
How to fix it?
Actually i made a mistake after that request i am getting the result with routes and but it also contains the encoder polyline object which consist of the array of lat lang, Once we decode that then we'll get all the points so that we can get the route correctly. The result consist of array of routes each element consist of array of legs(route details between two points) and each leg consist of steps finally each step has encoded polyline in order to get the correct latlang you should decode that polyline and use it.