Reputation: 27
I have created a button which takes the user to a specific location on Google Maps. Here is the snippet:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
However, the Map merely zooms to the particular location without adding a marker to the co-ordinates I have put. Can someone please help me?
Thank You.
Upvotes: 0
Views: 338
Reputation:
This works for me (the 'hellothere' is a label you can replace or remove):
String uri = String.format(Locale.ENGLISH, "geo:0,0?q=%f,%f(hellothere)",latitude,longitude);
UPDATE: the geo: parameter can be 0,0 when supplying a location query.
(When testing you may want to close the Map app each test particularly if not moving the marker.)
Upvotes: 1