8

Is it possible not only to have Google Maps on Android show a given coordinate in the Maps Application but have also a marker (or pin) set at the location?

I read the documentation at https://developer.android.com/guide/appendix/g-app-intents.html but it only lets me set the zoom level.

Right now I use the following code to show a place in Google Maps on Android:

Double lat = 53.3;
Double lng = 13.4;
final String uriString = "geo:" + lat + ',' + lng + "?z=15";
Intent showOnMapIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uriString));
startActivity(showOnMapIntent);

Is it possible to have a marker there or do I need to use a MapActivity? Where can I find the complete documentation on the url parameters that the Maps application understands?

Can I use a different url prefix? For example "https://maps.google.de/maps?"? Maps has an intent-filter matching this scheme/host/pathPrefix. Where can I find documentation on which parameters Google Maps for Android actually supports with this url?

Dirk Jäckel
  • 2,979
  • 3
  • 29
  • 47

3 Answers3

12

Dirk, have you tried geo:0,0?q=lat,lng?

it is displaying a marker on my nexus 5.

dbaq
  • 1,347
  • 14
  • 26
9

It works with the follwoing url:

final String uriString = "http://maps.google.com/maps?q=" + lat + ',' + lng + "("+ label +")&z=15";

The reverse geo coded address is shown.

I found documentation to the supported parameters here. This is not the documentation for Androids Google Maps but what I tried works.

Note: it should be noted that the original question was in regards to the the geo: URI to launch the Google Maps app (see Android Developer Reference Intents List, whereas this answer might launch a web view with the Google Maps website depending on what App the user chooses for this Intent.

Dirk Jäckel
  • 2,979
  • 3
  • 29
  • 47
  • thats coolm but unfortunately then google-earth does not catch the link - a mix of both would be cool ;-) – ligi Jun 11 '13 at 20:00
  • The above link is not working anymore. Should maybe be replaced with this: https://developers.google.com/maps/documentation/static-maps/intro?hl=en – meles May 18 '17 at 10:13
1

try this:

http://maps.google.com/?saddr=34.052222,-118.243611

and to get the complete route between two points:

http://maps.google.com/?saddr=34.052222,-118.243611&daddr=37.322778,-122.031944

delkant
  • 2,304
  • 1
  • 29
  • 28