2

I have some basic issue in Google Maps(Android). From my app, I want to open Google maps homepage alone. I do not need to pass any address or lat/long via intent. Just open the Google maps.

Intent mapIntent = new Intent(Intent.ACTION_VIEW);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

This code helps but only problem is the previous search route(if we did on Google maps) still shows while opening the google maps. I want to clear any routes if exists and open the Google maps. The idea is user will search the address manually from the Google Maps. From my App I just need to open the Google maps.

Any help!

Anees Deen
  • 1,385
  • 2
  • 17
  • 31

1 Answers1

1

Anyway, you can open Google Maps application in Driving Mode via intent as in this answer of Jason Maderski:

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);

Also take a look at this answer of icyerasor.

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79