Search code examples
androidgoogle-apilocation

Using an API to get the location details, based on ZIP code


In my Android app I want to use 'Country' and 'Zip code' to get 'State name' and 'City' or 'Village name'.

Is there any API available to get these information?


Solution

  • You can use Google Geocoding API, simple HTTP request with JSON response.

    Example: http://maps.googleapis.com/maps/api/geocode/json?address=94085&region=us

    {
        long_name: "California",
        short_name: "CA",
        types: [
            "administrative_area_level_1",
            "political"
        ]
    }
    

    But note that the free tier will support only:

    • 2,500 requests per 24 hour period.
    • 5 requests per second.