[英]Android google maps v2 navigation
I'm using google map v2 for showing locations in my application. 我正在使用Google Map v2在我的应用程序中显示位置。 When I want to navigate to that particular location I use the following code which starts the default navigation application installed in my phone.
当我想导航到该特定位置时,请使用以下代码启动安装在手机中的默认导航应用程序。
Intent navigation = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=aa,bb&daddr=xx,yy"));
startActivity(navigation);
So obviously we will leave our application and go to the default navigation application. 所以很明显,我们将离开我们的应用程序,然后转到默认导航应用程序。 Is there any chance that I can do the turn-by-turn navigation within the google map which is to be shown in my application itself?
我是否有可能在要显示在我的应用程序本身中的google map中进行逐行导航?
Is there any chance that I can do this navigation within the google map which is shown in my application itself?
我有没有可能在我的应用程序本身显示的google map中进行此导航?
Unfortunately no. 抱歉不行。 Google does not expose turn-by-turn navigation engine, so the maximum you can get with Google Map V2 is display route using route points returned from Route API.
Google不会公开转弯导航引擎,因此Google Map V2所能提供的最大功能就是使用从Route API返回的路线点显示路线。 Actual turn-by-turn needs to be done via proprietary Google Navigation app
实际的转弯需要通过专有的Google导航应用来完成
Yes you can display map in our application using MapFragment. 是的,您可以使用MapFragment在我们的应用程序中显示地图。 Below is an example for such a activity inside which you can add the mapfragment.
以下是此类活动的示例,您可以在其中添加mapfragment。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/fragmap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
EDIT: for directions use this- 编辑:对于方向使用此-
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="
+ destLat + ","
+ destLong + "&daddr="
+ srcLat + "," + strLong));
startActivity(intent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.