从Android应用程序中调用谷歌地图应用程序,以获取dirving方向 [英] Invoking Google Map Applications from an Android application to get dirving direction
问题描述
我需要使用外部谷歌地图应用程序,我发现这个链接显示行驶方向 HTTP ://developer.android.com/guide/appendix/g-app-intents.html ,但低于打开地图应用程序给定位置
I need to show the driving direction using external google map application i found this link http://developer.android.com/guide/appendix/g-app-intents.html ,but the below opens the Maps application to the given location
Uri uri = Uri.parse("geo:13.070984,80.253639");
Intent in = new Intent(Intent.ACTION_VIEW, uri);
startActivity(in);
我需要知道的是有什么办法可以传递两个的地理位置让行驶方向。
I need to know is there is any way to pass two geo location to get driving direction.
推荐答案
是它很容易显示的方向,如果你有源和目标的经度和纬度。 刚刚看到下面的code:
yes its very easy to show the direction if you have the latitude and longitude of both source and destination. Just see the following code:
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);
在哪里
latitude_source =纬度
源的
longitude_source =经度
源的
latitude_dest =纬度
您的目的地
longitude_dest =经度
您的目的地的
Where
latitude_source=Latitude
of your source
longitude_source=Longitude
of your source
latitude_dest=Latitude
of your destination
longitude_dest=Longitude
of your destination
只需更换这些值与实际数据。 。使用上述code对一些特定事件。
Just replace these value with your actual data. .Use the above code on some particular event.
希望这会帮助你。
这篇关于从Android应用程序中调用谷歌地图应用程序,以获取dirving方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!