java – How to plot a route using the maps API


I'm making an app in Android Studio for an event and I'd like to:

When opening a specific screen, the app would use the mobile gps to acquire the origin coordinates and would open the google maps app to create a route with the destination point at the event location.

thanks in advance



Try this way:

 // URL para abrir o google maps
final String ulrRoute = ",%s";

// Informe a latitude e longitude do local do evento
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse( String.format(Locale.getDefault(),ulrRoute, "-25.429138", "-49.271481") ));

// Informamos que queremos abrir a  Activity MapsActivity do
i.setClassName("", "");

Scroll to Top