Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I show a marker in Maps launched by geo URI Intent?

I have a application where I want to show different locations (one at the time, picked by user input) by launching Google Maps with their specific geo coordinates.

I'm currently using this (with real lat. and long. values of course):

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?z=17")); startActivity(intent); 

It's quite exactly what I want, except that it doesn't show any indicator or marker for the specified point. It only centers at it's location.

Is there some way to get the marker or something else included without using a MapView?

like image 222
Specur Avatar asked Oct 21 '10 17:10

Specur


People also ask

Can I put a marker on Google Maps?

Type the name of a location or address.Then tap Add new point. Drag the marker on the map to where you want to add a marker. Then tap Select this location.

What is the marker on Google Maps called?

The Google Maps pin is the inverted-drop-shaped icon that marks locations in Google Maps. The pin is protected under a U.S. design patent as "teardrop-shaped marker icon including a shadow". Google has used the pin in various graphics, games, and promotional materials.

How do I add a marker to Google Maps Center?

Once you have markers on the map, you can retrieve the Lat/Long coordinates through the API and use this to set the map's center. You'll first just need to determine which marker you wish to center on - I'll leave that up to you. Hope this helps.


1 Answers

Try this:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?q=<lat>,<long>(Label+Name)")); startActivity(intent); 

You can omit (Label+Name) if you don't want a label, and it will choose one randomly based on the nearest street or other thing it thinks relevant.

like image 120
Kenton Price Avatar answered Sep 23 '22 17:09

Kenton Price