0

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

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

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

1 回答 1

0

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

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 是您要导航到的目标地址。

于 2016-12-15T20:24:25.863 回答