简体   繁体   中英

Android Geocoder getFromLocation returns 0 results for valid locations

The code snippet below works from most lat/lon coordinates. However, passing specific coordinates returns no results.

Geocoder geocoder = new Geocoder(HappyApp.instance(), Locale.getDefault());
Log.w(TAG, "geocoder object created and is present: " + Geocoder.isPresent());
List<Address> addresses = geocoder.getFromLocation(32.0923805, 35.165159, 1);
Log.w(TAG, "List size: " + addresses.size());

Geocoder.isPresent() returns true. List size is 0. The location can be confirmaed by typing Ari'el in Google maps. Same for Gaza (just Gaza not strip).

My question is it an issue with Android API/Google maps or am I doing something wrong? Thanks.

It seems that Google avoid providing Country and other data where the territory is under controversy dispute like north Cyprus and the Gaza strip.

Whenever we get 0 results, we use the following online service: http://www.geonames.org

Google maps geocoder is not available in all regions of the world , period. If the same app will work for a different region except for a particular one (esp Africa and Middle East), its just because that area isnt really covered by geocoder.

:(

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM