Closed gamebusterz closed 6 years ago
Any help please ?
Don't forget to enable the Google Maps Direction API before get a new server key.
Any one solved this? My route aint displaying
No, still doesn't work for me. My Direction API was already enabled.
@gamebusterz,
You are missing a key component to show the route. Try doing the following:
if(direction.isOK()) {
try{
List<Step> stepList = direction.getRouteList().get(0).getLegList().get(0).getStepList();
ArrayList<PolylineOptions> polylineOptionList = DirectionConverter.createTransitPolyline(getActivity(), stepList, 5, routeColor, 3, Color.BLUE);
for (PolylineOptions polylineOption : polylineOptionList) {
mMap.addPolyline(polylineOption);
}
}catch (Exception e){
e.printStackTrace();
}
}
The snippet in the try block will draw the polyline between source and destination. Hope this helps.
Best, Sagar
I have added the Gradle dependency, and followed the documentation and I can see in the Console that my Google Maps Directions API is being used. But there is no path that is being displayed between the origin and the destination.
If it helps, I am already adding an Origin and a Destination marker to the app, so I hope this library doesn't try to add those markers as well, and might be causing some problem, but still there should've been a visible path.
Android 6.0
Android Studio 2.12