0

I am using below code to open direction from current location to particular location in Google Maps.

But the code first shows me "Open With dialog" giving user choice to open with other components also. I want user to be taken directly to Google maps without giving him choice to select. How can I do that?

   String uri = "https://maps.google.com/maps?f=d&daddr="+location;
   Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
   startActivity(i);
Phiter
  • 14,570
  • 14
  • 50
  • 84
Android Developer
  • 9,157
  • 18
  • 82
  • 139

1 Answers1

0

You can use the below format (not officially supported):

https://www.google.com/maps/dir/My%20location/DESTINATION_ADDRESS

OR

https://www.google.com/maps?saddr=My+Location&daddr=DESTINATION_ADDRESS

eg:

https://www.google.com/maps/dir/My%20location/world%20of%20coca%20cola

https://www.google.com/maps?saddr=My+Location&daddr=world%20of%20coca%20cola

Where DESTINATION_ADDRESS is the destination address you want to navigate to.

Jaspal Singh
  • 1,210
  • 1
  • 12
  • 17