Take the 2-minute tour ×

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

(For example: Nearby police station from my current 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?

share|improve this question
what have you tried so far? –  MKJParekh Dec 8 '11 at 8:43
At this point I can able to load my current loaction in google map. –  agiles Dec 8 '11 at 8:48
androidhive.info/2012/08/… –  DroidBot Mar 1 '13 at 5:30
add comment

4 Answers

up vote 68 down vote accepted
  1. First go through this tutorial for getting familiar with Android Google Maps.

  2. To retrive the current location of device see this answer or this another answer.

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

  4. After getting Placemarks of near by location use this project to show markers on map with balloon overlay.

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

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

share|improve this answer
very nice Answer –  Chirag Patel Jan 3 '12 at 6:28
+1 for nice answer. . –  Chirag Raval Mar 17 '12 at 11:08
If any of the links fail to open please do comment here,Will change it with the best example/blog available. –  MKJParekh Jun 7 '12 at 7:21
+1 for the Nice Answer. –  Bhavesh Patadiya Sep 29 '12 at 13:35
add comment

Lots of answers so far, which are all excellent pointers to API's and tutorials. One thing I'd like to add is that I work out how far the markers are from my location using something like:

float distance = (float) loc.distanceTo(loc2);

Hope this helps refine the detail for your problem. It returns a rough estimate of distance (in m) between points, and is useful for getting rid of POI that might be too far away - good to declutter your map?

share|improve this answer
add comment

You have two options for displaying the Map

  1. Use Maps Library for Android to render the Map
  2. Use Maps API V3 inside a web view

For showing local POIs around a Lat, Long use Places APIs

share|improve this answer
add comment

You can use google map Obtaining User Location here!

After obtaining your location(longitude and latitude), you can use google place api

This code can help you get your location easily but not the best way.

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
String bestProvider = locationManager.getBestProvider(criteria, true);
Location location = locationManager.getLastKnownLocation(bestProvider);  
share|improve this answer
add comment

protected by Lalit Poptani Jun 1 '12 at 13:05

