So I'm trying to implement a AutoCompleteTextView with cities (in Belgium).
This is the url I call :
This is the result I receive
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Sint-Niklaas",
"short_name" : "Sint-Niklaas",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Oost-Vlaanderen",
"short_name" : "OV",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Vlaams Gewest",
"short_name" : "Vlaams Gewest",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "België",
"short_name" : "BE",
"types" : [ "country", "political" ]
}
],
"adr_address" : "\u003cspan class=\"locality\"\u003eSint-Niklaas\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eBelgië\u003c/span\u003e",
"formatted_address" : "Sint-Niklaas, België",
"geometry" : {
"location" : {
"lat" : 51.1558839,
"lng" : 4.154440999999999
},
"viewport" : {
"northeast" : {
"lat" : 51.2078001,
"lng" : 4.22161
},
"southwest" : {
"lat" : 51.12957000000001,
"lng" : 3.985439999999999
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "b58d02f8e9b9e23b20672df537655b0db8df49c4",
"name" : "Sint-Niklaas",
"place_id" : "ChIJbTeC4aKOw0cRjfRXrcMzDNY",
"reference" : "CoQBeAAAANQfy31Z2rrxWOIYEkCCVh-jrEdi-WRLSJdxwO2SnZPtrumlfQdtzwW3CwFZ9qP8hgNmVYO9HySMMQ28dWm45YYnW-NJ2XmNepK0keyPOlZ6BAyeDhTa56aE-3cqYUHE6GE_h70kw6uh-cWuImPJ64k-Pc7YgX6EoZYFIvO3PexDEhAkMx1ebDvOUVUcLK8XL-MiGhQkYJEvxLQHO0qz72wpSmdqlDkrtA",
"scope" : "GOOGLE",
"types" : [ "locality", "political" ],
"url" : "https://maps.google.com/maps/place?q=Sint-Niklaas,+Belgi%C3%AB&ftid=0x47c38ea2e182376d:0xd60c33c3ad57f48d",
"vicinity" : "Sint-Niklaas"
},
"status" : "OK"
}
But I've read that you could get place details with the place details API, so I've tried to search on the placeid I received:
This returns a whole bunch of data but no postal code:
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Sint-Niklaas",
"short_name" : "Sint-Niklaas",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Oost-Vlaanderen",
"short_name" : "OV",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Vlaams Gewest",
"short_name" : "Vlaams Gewest",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "België",
"short_name" : "BE",
"types" : [ "country", "political" ]
}
],
"adr_address" : "\u003cspan class=\"locality\"\u003eSint-Niklaas\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eBelgië\u003c/span\u003e",
"formatted_address" : "Sint-Niklaas, België",
"geometry" : {
"location" : {
"lat" : 51.1558839,
"lng" : 4.154440999999999
},
"viewport" : {
"northeast" : {
"lat" : 51.2078001,
"lng" : 4.22161
},
"southwest" : {
"lat" : 51.12957000000001,
"lng" : 3.985439999999999
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "b58d02f8e9b9e23b20672df537655b0db8df49c4",
"name" : "Sint-Niklaas",
"place_id" : "ChIJbTeC4aKOw0cRjfRXrcMzDNY",
"reference" : "CoQBeAAAANQfy31Z2rrxWOIYEkCCVh-jrEdi-WRLSJdxwO2SnZPtrumlfQdtzwW3CwFZ9qP8hgNmVYO9HySMMQ28dWm45YYnW-NJ2XmNepK0keyPOlZ6BAyeDhTa56aE-3cqYUHE6GE_h70kw6uh-cWuImPJ64k-Pc7YgX6EoZYFIvO3PexDEhAkMx1ebDvOUVUcLK8XL-MiGhQkYJEvxLQHO0qz72wpSmdqlDkrtA",
"scope" : "GOOGLE",
"types" : [ "locality", "political" ],
"url" : "https://maps.google.com/maps/place?q=Sint-Niklaas,+Belgi%C3%AB&ftid=0x47c38ea2e182376d:0xd60c33c3ad57f48d",
"vicinity" : "Sint-Niklaas"
},
"status" : "OK"
}
What am I doing wrong?