I searched quite a bit with no luck.
The Android geocoder returns an android.location.Address object. The city, as I understand it, should be returned in getLocality() . It seems like it works well in the US, but not on the outside.
I am writing an international application and trying to find a solution to find out the city of geolocation.
Here is the conclusion from the Czech Republic / Prague:
Address[addressLines= [0:"Psohlavců 1764/2", 1:"147 00 Prague-Prague 4", 2:"Czech Republic"], feature=2, admin=Hlavní město Praha, sub-admin=Prague, locality=null, thoroughfare=Psohlavců, postalCode=147 00, countryCode=CZ, countryName=Czech Republic, hasLatitude=true, latitude=50.0276543, hasLongitude=true, longitude=14.4183926, phone=null, url=null, extras=null]
locality is null, the city is within sub-admin ! The address itself is approved, so the geocoding server seems to know the city.
Here are some ore random examples of the EU, but the locality partially works:
Address[addressLines=[0:"Nad lesem 440/34",1:"147 00 Prague-Prague 4",2:"Czech Republic"],feature=34,admin=Hlavní město Praha,sub-admin=Prague,locality=null,thoroughfare=Nad lesem,postalCode=147 00,countryCode=CZ,countryName=Czech Republic,hasLatitude=true,latitude=50.02424,hasLongitude=true,longitude=14.4117568,phone=null,url=null,extras=null] Address[addressLines=[0:"Hauner Straße 4",1:"84431 Heldenstein",2:"Germany"],feature=4,admin=null,sub-admin=null,locality=Heldenstein,thoroughfare=Hauner Straße,postalCode=84431,countryCode=DE,countryName=Germany,hasLatitude=true,latitude=48.2540274,hasLongitude=true,longitude=12.3413535,phone=null,url=null,extras=null] Address[addressLines=[0:"Igler Straße",1:"6020 Innsbruck",2:"Austria"],feature=Igler Straße,admin=Tyrol,sub-admin=Innsbruck,locality=Innsbruck,thoroughfare=Igler Straße,postalCode=6020,countryCode=AT,countryName=Austria,hasLatitude=true,latitude=47.2465698,hasLongitude=true,longitude=11.4054237,phone=null,url=null,extras=null] Address[addressLines=[0:"Durnberg 24",1:"5724 Stuhlfelden",2:"Austria"],feature=24,admin=Salzburg,sub-admin=Zell am See District,locality=null,thoroughfare=Durnberg,postalCode=5724,countryCode=AT,countryName=Austria,hasLatitude=true,latitude=47.3233373,hasLongitude=true,longitude=12.4960482,phone=null,url=null,extras=null] Address[addressLines=[0:"U Roháčových kasáren 14",1:"100 00 Prague 10",2:"Czech Republic"],feature=14,admin=Hlavní město Praha,sub-admin=Prague,locality=Prague 10,thoroughfare=U Roháčových kasáren,postalCode=null,countryCode=CZ,countryName=Czech Republic,hasLatitude=true,latitude=50.0704092,hasLongitude=true,longitude=14.4673473,phone=null,url=null,extras=null]
Maybe the fault is on me, but it seems to me that depending on the country and region the city will be found in different areas. However, the address itself is apparently good enough to send an email.
Has anyone written a smart feature that is trying to get the most out of Geocoder results? It’s a pity that Google stores information, but does not provide it properly.