How to plot a route using maps API

3

I'm making an application in Android Studio for an event and would like it to:

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

Thanks in advance,

    
asked by anonymous 30.09.2016 / 18:52

1 answer

2

Welcome!

Try this:

 // URL para abrir o google maps
final String ulrRoute = "https://maps.google.com?saddr=Current+Location&daddr=%s,%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 com.google.android.apps.maps
i.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");

startActivity(i);
    
30.09.2016 / 19:40