1

Postal code is always null in address.getPostalCode() of Adress class from Geocoder Android Api, but am able to see the complete address with postal code (i dont want to split the postal code from the full address). Please suggest is there any other ways to extract the same.enter image description here

Ravi
  • 111
  • 1
  • 5
  • did you already try to change the address, did you still have null on your postalCode? – Tai Nguyen Oct 19 '16 at 09:32
  • I have faced same issue in the same location I meant in bangalore I have got null as well. So what I have tried is First I am trying to get from Geocoder. If I didn't get from Geocoder I am trying it by using the http://maps.google.com/maps/api/geocode api and split the address to get the zip. – Raghavendra Oct 19 '16 at 09:36
  • @AlainProfessional Yes tried at different locations from different deveices, giving the same results. I think the problem is with the Google Api itself may be in parsing the result – Ravi Oct 19 '16 at 10:01
  • @Raghavendra the Url you mentioned has usage limit. is there any way to retrive it by free api's – Ravi Oct 19 '16 at 10:09
  • @Ravi I couldn't found any other way buddy. If you find something pls update here as well. – Raghavendra Oct 19 '16 at 10:14

1 Answers1

0

It seems that the Google API isn't parsing some of your addresses completely. Address parsing is really not straightforward, and the differences across countries add complexity. I'm surprised your addresses aren't working with Google, but you might find that other providers are more helpful in this area.

I suggest you try SmartyStreets. Their primary focus is on parsing, autocompleting, and validating addresses. I tried the address shown in your image and it parsed correctly, including filling the postal code field. You can try it on the demo page. They have an Android SDK.

As a caveat, it does cost money for lookups (there are different tiers including a free tier if you only do a couple hundred lookups per month).

Fair disclosure: I work for SmartyStreets.

Joseph Hansen
  • 12,665
  • 8
  • 50
  • 68