androidgoogle-mapsandroid-intentgoogle-maps-urls

Android - How to launch Google map intent in driving mode?


I am able to launch Google Maps intent with

Uri location = Uri.parse("geo:0,0");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
startActivity(mapIntent);

How can I launch the intent in Driving mode (with no destination, unless previously set in Maps) so that it looks like on the screenshot below?

enter image description here

I tried setting mode=driving but that just opens the regular map with the "driving" tab selected:

 Uri location = Uri.parse("geo:0,0?mode=driving");

Solution

  • This will launch google maps in Driving Mode

        Intent intent = getPackageManager().getLaunchIntentForPackage("com.google.android.apps.maps");
        intent.setAction(Intent.ACTION_VIEW);
        intent.setData(Uri.parse("google.navigation:/?free=1&mode=d&entry=fnls"));
        startActivity(intent);