1
Hello guys, beauty? So, I’m developing an application using Android Studio and Google Maps API. So I came across a question that until then I couldn’t find anything that could solve my problem. Here’s the thing, I’m working with Routes and by default Google maps uses the "Driving" route when creating JSON to mount the route in the app. I would like to change this standard "travel mode" to other options like bike, race, train and etc. Someone has already come across this and by some chance managed to solve?
This is my class:
private void criarUrlGoogleDirections(){
urlGoogleDirections = "http://maps.googleapis.com/maps/api/directions/json?origin=" +
latLngPontoPartida.latitude + "," + latLngPontoPartida.longitude +
"&destination=" + latLngPontoFinal.latitude + "," + latLngPontoFinal.longitude +
"&waypoints=";
for (int i = 0; i < objListaLatLngWaypoints.size(); i++) {
urlGoogleDirections += objListaLatLngWaypoints.get(i).latitude
+ "," + objListaLatLngWaypoints.get(i).longitude;
if ((i+1) < objListaLatLngWaypoints.size()) {
urlGoogleDirections += "|";
}
}
urlGoogleDirections += "&sensor=false";
Log.i("URL", urlGoogleDirections);
}
How are you getting the route?
– ramaral
I am using a method called "urlGoogleDirections" to create a url according to the Source, Destination and Reference points defined on the map. There is a class called Jsonrota that connects to a server and downloads the route according to Google maps.
– Vinícius Oliveira
Ask the question this part of the code.
– ramaral