1

I want to show navigation direction while clicking the info window.

I tried some code, it shows the Preview button, but it does not show the navigation button.

I got it like in the picture below: Note Below Preview Icon

But, I want it like this:

Here my code:

 final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?" +
            "saddr="+ gps.latitude + "," + gps.longitude + "&daddr=" + marker.getPosition().latitude + "," +
            marker.getPosition().longitude+ "&sensor=false&units=metric&mode=driving"));
            intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
            startActivity(intent);
mrunde
  • 684
  • 6
  • 14
Abu
  • 39
  • 3
  • 9

1 Answers1

0

You can follow this documentation on how to launch Google Maps navigation with turn-by-turn directions to the address or coordinate specified.

Here is a sample Intent which requests turn-by-turn navigation to Taronga Zoo, in Sydney Australia:

Uri gmmIntentUri = Uri.parse("google.navigation:q=Taronga+Zoo,+Sydney+Australia");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

Check these related SO threads:

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59