Question

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)));
Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top