【问题标题】:Opening directions in Google maps directly直接在谷歌地图中打开路线
【发布时间】:2016-05-31 15:34:40
【问题描述】:

我正在使用以下代码打开从当前位置到 Google 地图中特定位置的方向。

但代码首先向我显示“使用对话框打开”,让用户也可以选择使用其他组件打开。我希望用户直接被带到谷歌地图而不让他选择。我该怎么做?

   String uri = "https://maps.google.com/maps?f=d&daddr="+location;
   Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
   startActivity(i);

【问题讨论】:

  • 如果用户没有谷歌地图应用...?
  • @MarkChorley 我认为所有的安卓手机都默认有谷歌地图应用程序?

标签: android google-maps maps nativeapplication


【解决方案1】:

您可以使用以下格式(官方不支持):

https://www.google.com/maps/dir/My%20location/DESTINATION_ADDRESS

https://www.google.com/maps?saddr=My+Location&daddr=DESTINATION_ADDRESS

例如:

https://www.google.com/maps/dir/My%20location/world%20of%20coca%20cola

https://www.google.com/maps?saddr=My+Location&daddr=world%20of%20coca%20cola

其中 DESTINATION_ADDRESS 是您要导航到的目标地址。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多