Calling Maps intent with geolocation, is it possible to have a pushpin on it? [duplicate]

StackOverflow https://stackoverflow.com/questions/14274815

  •  14-01-2022
  •  | 
  •  

Pregunta

Possible Duplicate:
How to show marker in Maps launched by geo uri Intent?

I have an intent to a Google Maps application with one geolocation I got from my database, is it possible for GM to put a pushpin in the location I'm sending with the URI?

final String uri = "geo:" + location.Latitude + "," + location.Longitude + "?z=12";
MyActivity.this.startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
¿Fue útil?

Solución

You need to specify a name for the pin:

String uri = "geo:0,0?q="+ Lat + "," + Longitude + " (" + name+ ")";
startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));

This will work for one pin only.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top