code, code, etc.

The musings of a disjointed mind

Reverse Geocode Lookup Using Google Maps API on Android

| Comments

In a recent app using geolocation, I wanted to show the user of my app a city name of where the phone’s GPS receiver was placing them (just so they can be sure it is right). It turns out the Google Maps API has a HTTP service, and all you need to do is hit a certain URL, and google returns a list of nearby addresses (including city name). You can specify different formats that google passes back, including xml, kml, and json. I implemented a call to the service using java’s HttpURLConnection class. Here’s the code:

For more information on the Google Maps API service for geocoding, checkout this url: