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?
This question is related to
android
google-maps
google-places-api
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);
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?
You have two options for displaying the Map
For showing local POIs around a Lat, Long use Places APIs
Source: Stackoverflow.com