简体   繁体   English

使用Google Maps API v2的Google地图导航

[英]Google map navigation using Google Maps API v2

I am using Google Maps API v2 in my app. 我在我的应用中使用Google Maps API v2。 I want to enable navigation feature in my app. 我想在我的应用程序中启用导航功能。 I have read other posts which start an Intent and open stock Google Maps application to show navigation. 我已经阅读了其他文章,这些文章启动了Intent并开放了库存的Google Maps应用程序以显示导航。 But I want to display the navigation inside my application( SupportMapFragment that I have used) only. 但是我只想显示应用程序内部的导航(我使用过的SupportMapFragment )。 How can I implement that? 我该如何实施?

This code works well but it starts an Intent : 这段代码运行良好,但是启动了一个Intent

Intent NavIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + incAddress));
    startActivity(NavIntent);

there is no way to show the google maps app navigation in your app, it is a completely different app. 无法在您的应用程序中显示google maps应用程序导航,这是一个完全不同的应用程序。 the only way you can display navigation in your app is to use Google Directions API and plot the route on your map but then you dont have the turn by turn directions. 您可以在应用中显示导航的唯一方法是使用Google Directions API并在地图上绘制路线,但是您没有转弯路线。

I created a library that uses the google directions api and its easy to use if you want to try it out. 我创建了一个使用谷歌Directions API的库,如果您想尝试它,它易于使用。

https://github.com/tyczj/MapNavigator https://github.com/tyczj/MapNavigator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM