How to parse Address from Google Places GeoDataApi for Android, (address_components missing)

只愿长相守 提交于 2019-11-30 19:21:39
Richard Le Mesurier

Unfortunately the answer is "You can't."

Google does not supply structured response data to the Android implementation of that API.

You could try parsing the address text, but as per my answer to a related post, this is far from trivial:

  1. You figure out a clever way to parse that string. Unfortunately the actual street/suburb/town/province structure is not consistent across different areas (e.g. Cape Town in South Africa has a different sentence structure to Johannesburg in South Africa). So your parsing rules need to be very clever.
  2. You use a different Google API. The JavaScript API provides structured data for the related call. Unfortunately Google recommends against using this technique.

A colleague of mine has logged this issue with Google:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!