使用经度和纬度时,启动Google地图以使导航无效

时间:2017-10-21 21:04:24

标签: android google-maps google-maps-android-api-2

我的andoroid应用程序中有经度和纬度值,我正在将它们传递给url,正如官方的android文档所说的那样 -

 String query_string = "google.navigation:q=" +location.getLatitude()+","+location.getLongitude();
 Uri gmmIntentUri = Uri.parse(query_string);
 Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
 //mapIntent.setPackage("com.google.android.apps.maps");
 startActivity(mapIntent);

谷歌地图打开很安静,但它允许找到路线无法找到。

enter image description here

我可以看到我在Google地图地址栏中传递的经度和纬度值。它显示了找到最佳路线'然后显示错误消息'没有找到路线'。它也适用于所有模式(步行,驾驶......)。不确定为什么。

1 个答案:

答案 0 :(得分:0)

我看过你的截图。我可以看到您尝试从当前位置找到行车路线以协调3.2949945,6.5993606。

然而,3.2949945,6.5993606位于几内亚湾内的水域。您可以在地理编码工具中看到这一点:

https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D3.294995%252C6.599361

enter image description here

我想你的目的是找到一条通往6.5993606,3.2949945的路线:

https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D6.599361%252C3.294995