我需要使用外部谷歌地图应用程序显示行车方向我找到了这个链接http://developer.android.com/guide/appendix/g-app-intents.html http://developer.android.com/guide/appendix/g-app-intents.html,但下面将打开地图应用程序到给定的位置
Uri uri = Uri.parse("geo:13.070984,80.253639");
Intent in = new Intent(Intent.ACTION_VIEW, uri);
startActivity(in);
我需要知道是否有任何方法可以通过两个地理位置来获取行车方向。
是的,如果您有源地和目的地的纬度和经度,那么很容易显示方向。
只需看下面的代码:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+latitude_source+","+longitude_source+"&daddr="+latitude_dest+","+longitude_dest));
startActivity(intent);
Where
latitude_source=Latitude
你的来源longitude_source=Longitude
你的来源latitude_dest=Latitude
您的目的地longitude_dest=Longitude
您的目的地
只需将这些值替换为您的实际数据即可。
.在某些特定事件上使用上面的代码。
希望对你有帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)