【问题标题】:how to get the google map url of my current location in Android?如何在Android中获取我当前位置的谷歌地图网址?
【发布时间】:2018-04-14 06:12:36
【问题描述】:

我正在尝试获取当前位置的确切 URL,将我的 gps 位置显示为地图上的标记。

【问题讨论】:

  • 先显示一些努力。
  • 阅读谷歌地图 api 文档。在你的最后做一些努力。如果遇到困难,请分享您的代码试验。阅读此page 以了解如何提出好问题。

标签: android google-maps android-studio geolocation location


【解决方案1】:

您可以使用这种格式的链接:

https://www.google.com/maps/search/?api=1&query=36.26577,-92.54324

并将您所在位置的latitudelongitude 分别添加到36.26577-92.54324 的位置。

【讨论】:

    【解决方案2】:
     http://maps.google.com/?q=<lat>,<lng>
    

    使用上述格式,将您的 lat 和 lng 值传递给上述 URL 格式。

    【讨论】:

      【解决方案3】:

      您可以将它与android Intent一起使用。

      String geoUri = "http://maps.google.com/maps?q=loc:" + <lat-long>;
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoUri));
      startActivity(intent);
      

      或者只是网址

      "http://maps.google.com/maps?q=loc:" + <lat-long>;
      

      【讨论】:

        猜你喜欢
        • 2014-02-19
        • 2021-09-11
        • 2018-02-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-26
        相关资源
        最近更新 更多