在 Android 中使用 Google Maps API 显示当前位置和附近地点以及两个地点之间的路线 [英] Show Current Location and Nearby Places and Route between two places using Google Maps API in Android

查看:35
本文介绍了在 Android 中使用 Google Maps API 显示当前位置和附近地点以及两个地点之间的路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Android 中使用 Google 地图 开发一个应用程序来定位我的当前位置,并且需要找到最近的位置.

I need to develop an application using Google Maps in Android to locate my current location and need to find nearest location.

(例如:我当前位置附近的警察局.)

它应该接受我当前的位置并且输出应该显示最近的位置.

It should accept my current location and output should display nearest place.

谁能帮我提供一些建议、链接、教程来做到这一点?

Can anyone help me to give some suggestion,links,tutorial to do that?

推荐答案

  1. 首先阅读本教程 用于熟悉Android 谷歌地图和这个 API 2.

要检索设备的当前位置,请参阅这个答案 或这个另一个答案API 2

To retrive the current location of device see this answer or this another answer and for API 2

然后您可以使用 谷歌地方API 以及关于 Place Api 的使用,请参见 此博客.

Then you can get places near by your location using Google Place API and for use of Place Api see this blog.

获得附近位置的地标后,使用 这个带有源代码的博客,使用 API 2 在地图上显示带有气球覆盖的标记.

After getting Placemarks of near by location use this blog with source code to show markers on map with balloon overlay with API 2.

你也有很好的样本来绘制地图上两点之间的路线在这些链接中查看这里Link1Link2 和这个 很好的答案.

You also have great sample to draw route between two points on map look here in these links Link1 and Link2 and this Great Answer.

按照这些步骤操作后,您就可以轻松完成申请了.唯一的条件是,您必须阅读并理解它,因为就像魔术一样,它不会在一次点击中完成.

After following these steps you will be easily able to do your application. The only condition is, you will have to read it and understand it, because like magic its not going to be complete in a click.

这篇关于在 Android 中使用 Google Maps API 显示当前位置和附近地点以及两个地点之间的路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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