korovaisdead
korovaisdead

Reputation: 6341

Drop pin in MapView

I readed this: Drop Pin on Default Google Maps from My App in Android? and do all the same. But there is no pin droped on the map, after i call: startActivity(new Intent(Intent.ACTION_VIEW, uri));

The map centered on that uri-location, but no any pin dropped on the map.

So, there is a question: How to drop pin on the map?

Upvotes: 2

Views: 3285

Answers (1)

Kevin
Kevin

Reputation: 11662

You need to add something to search for too (the q param). If all you have is a lon/lat, specify it twice as below:

Uri uri = Uri.parse("geo:36.4248,-5.14495?z=14&q=36.4248,-5.14495"); 
Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
startActivity(intent); 

Note that the z parameter is optional.

You can also label the pin by adding it in brackets after the q's lon i.e.

Uri uri = Uri.parse("geo:36.4248,-5.14495?z=14&q=36.4248,-5.14495(My+pin+label)"); 
Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
startActivity(intent); 

Upvotes: 8

Related Questions