显示标记在GEO:-url在Android地图标记、地图、url、GEO

2023-09-05 11:12:09 作者:胆怯的猫儿

是否有可能不仅有谷歌地图Android上显示一个给定的地图应用程序配合,但也有一个标记(或引脚)设置的位置?

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?

我读https://developer.android.com/guide/appendix/g-app-intents.html但它只是让我设置缩放级别。

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

现在我用下面的code展现在Android上谷歌地图的地方:

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

是否有可能有一个标记或有我需要使用MapActivity? 我在哪里可以找到的地图应用程序理解?

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?

我可以使用不同的URL preFIX?例如https://maps.google.de/maps?? 地图有一个意图过滤器匹配该方案/主机/路径preFIX。 我在哪里可以找到文件对哪些参数谷歌地图Android版确实支持这个网址?

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?

推荐答案

它的工作原理与follwoing网址:

It works with the follwoing url:

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

反向地理codeD地址显示。

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.

注:应该指出的是,原来的问题是关于在地理:URI启动谷歌地图应用程序(见的 Android开发者参考意图列表,而这个答案可能会推出与谷歌地图网站取决于应用程序的用户选择什么该意图的Web视图。

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.