I am building an app that needs to access the user's zip code after getting the latitude and longitude. How can I get the zip using lat and lng?
Asked
Active
Viewed 3,682 times
1
-
1You are going to need to use a service which can map latitude and longitude to a zip code. Keep in mind that zip codes can change for many reasons, e.g. a redistricting after an election. – Tim Biegeleisen Jun 02 '16 at 04:39
1 Answers
0
In addition to native Geocoder class you can use Geocoding API web service. The web service has a reverse geocoding functionality:
https://developers.google.com/maps/documentation/geocoding/intro?hl=en#ReverseGeocoding
So you can specify latitude,longitude and a result type that you would like to get back.
In your use case it should be something similar to:
In Android you can use AndroidHttpClient class to execute HTTP request:
https://developer.android.com/reference/android/net/http/AndroidHttpClient.html

xomena
- 31,125
- 6
- 88
- 117