是否可以使用 Google 地图在 Android/iOS 上创建转弯 GPS 导航应用程序? [英] Is it possible to create turn-by-turn GPS navigation app on Android/iOS using Google Maps?

查看:15
本文介绍了是否可以使用 Google 地图在 Android/iOS 上创建转弯 GPS 导航应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我和一个客户谈过,他想在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 上的 Google Maps API 中实现,除了我在自己的应用程序中找不到任何有关 Turn-by-turn 导航实现的有用信息(无需切换到 Google Maps 应用程序).​​.

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 地图来创建基于 GPS 的逐向导航应用程序?

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

谢谢

推荐答案

阅读 Tushar 的回答在使用此答案之前在下面

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.

我会选择第二个选项,它很容易实现.

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

这篇关于是否可以使用 Google 地图在 Android/iOS 上创建转弯 GPS 导航应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆