是否有可能建立转由转GPS导航应用在Android上使用谷歌地图?有可能、用在、地图、转由

2023-09-12 06:33:23 作者:年少怎么不叛逆╮

今天,我已经说过了一个客户,他希望在Android上构建一个简单的导航APP!

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

基本上,我们可以使用谷歌地图,将一些我们的标记,以表明一些地点(餐馆,饭店等)..我们也需要显示用户的好友附近!

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的谷歌地图API,但我找不到有关转由turn导航实现在我自己的应用程序的任何有用的信息(而无需切换到谷歌地图应用程序)。

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) ..

有人可以简单地澄清 - ?是否有可能使用谷歌地图内的Andr​​oid应用程序创建转由转GPS基于应用程序

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

感谢

推荐答案

编辑:使用这个答案之前,阅读下面由图莎尔答案

如果要完全实现应用程序的导航,你将不得不使用谷歌地图API和谷歌路线API的组合。他们可以自由地使用到一个极限,那么你必须支付的API请求。( HTTPS ://developers.google.com/maps/documentation/directions/ )

If you want to implement the navigation completely in 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/)

我只想送你想浏览的位置的经度和纬度来给设备地图应用程序。下面是一些code用这种方法开始你了:

I would just send the latitude and longitude of the location you want to navigate to 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 Maps app and plot the location and the user can use the app to do what ever they want.

我将与第二个选项去,那是愚蠢容易实现。

I would go with the second option, it is stupidly easy to implement.