Search code examples
androidgoogle-mapspushpin

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


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

Solution

  • 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.