【问题标题】:Google maps driving mode url scheme not working on Android谷歌地图驾驶模式 url 方案不适用于 Android
【发布时间】:2014-03-06 10:19:52
【问题描述】:

我正在尝试从我的Android 应用程序调用外部Google Maps 应用程序。

Intent mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=" + stringLatitude + "," + stringLongitude + "&daddr=" + latitud + "," + longitud+"&dirflg=d"));

startActivity(mIntent);

它在Android 2.3.6 上完美运行。

但不是在Android 4.2 上,我第一次单击执行该代码的按钮时Google Maps 已正确打开,但那里没有显示任何有关驾驶模式的信息。

但是一旦我回到主应用程序,我再次单击按钮一切正常。它仅在第一次尝试时失败。

我不明白发生了什么

有什么线索吗?

【问题讨论】:

  • 我不敢相信。真的发生了。

标签: android google-maps android-intent


【解决方案1】:

我正在使用以下代码在 android 4.2 上运行良好

Intent i = new Intent(android.content.Intent.ACTION_VIEW, 
           Uri.parse("http://maps.google.com/maps?saddr="+a+","+b+"&daddr="+c+","+d+"&mode=driving"));
i.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(i);

【讨论】:

  • 完美运行!我还在Android 4.3 上对其进行了测试,并且可以正常工作。非常感谢!
  • 摩托车的模式键是什么?
  • @ChetakBhimani 它应该与“驾驶”不同,因为我们在谷歌地图中获得了这两个选项,并且它们显示了“驾驶”和“摩托车”的不同路线
猜你喜欢
  • 1970-01-01
  • 2015-12-17
  • 2019-04-30
  • 1970-01-01
  • 2013-05-22
  • 2013-02-10
  • 2012-12-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多