是否可以使用Google Maps在Android/iOS上创建转弯GPS导航应用程序?

问题描述:

今天,我与一位客户进行了交谈,他想在Android上构建一个简单的导航APP!

Today I've talked to a client and he wants to build a simple navigation APP on Android!

基本上,我们可以使用Google地图,放置一些我们的"标记来显示一些位置(餐厅,酒店等)..我们还需要显示附近的用户朋友!

Basically we could use Google maps, place some of "our" markers to show some locations (restaurants, hotels etc.) .. also we need to show user's friends near by!

使用Android上的Google Maps API可以进行所有操作,除了我无法在自己的应用程序中找到有关转弯导航实施的任何有用信息(无需切换到Google Maps App).

Everything of that is possible in Google Maps API on Android, except I can not find any useful information about Turn-by-turn navigation implementation inside my own app (without switching to Google Maps App) ..

有人可以简单说明吗-是否可以在Android应用中使用Google Maps来创建基于转弯GPS的应用?

Can someone simply clarify - is it possible to use Google Maps inside an Android app to create turn-by-turn GPS based app?

谢谢

阅读塔萨尔的答案在使用此答案之前

Read answer by Tushar below before using this answer

第一个选项

如果您想在应用中完全实现导航,则必须使用Google Maps API和Google Directions API的组合.它们可以免费使用到最高限额,然后您必须支付api请求的费用.( https ://developers.google.com/maps/documentation/directions/)

If you want to implement the navigation completely in your app you will have to use a combination of the Google Maps API and the Google Directions API. They are free to use up to a limit and then you have to pay for the api requests.(https://developers.google.com/maps/documentation/directions/)

第二个选项

我只需将要导航到的位置的纬度和经度发送到设备地图"应用即可.这是一些使用此方法开始的代码:

I would just send the latitude and longitude of the location you want to navigate to the devices Maps app. Here is some code to start you off with this method:

double lat = < latitude of the location you want to navigate to>

double lng = < longitude of the location you want to navigate to>     

String format = "geo:0,0?q=" + lat + "," + lng + "( Location title)";

Uri uri = Uri.parse(format); 


Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

这将打开设备的地图"应用并绘制位置,用户可以使用该应用执行所需的操作.

This will open the device's Maps app and plot the location and the user can use the app to do what ever they want.

我会选择 Second Option ,它非常容易实现.

I would go with the Second Option, it is stupidly easy to implement.