Geo Coder Error

我只是一个虾纸丫 提交于 2019-12-13 07:31:54

问题


I am using geo coder class to find the address, but I, get a IOException with message, of "Service Not Available", How I can solve this problem.


回答1:


This is a know issue with the Emulator. It works fine on an actual device

On 2.2 API 8 you'll receive the following stacktrace

java.io.IOException: Service not Available
at android.location.Geocoder.getFromLocation(Geocoder.java:117)

See here for more info (and a possible workaround) see the following URL :

http://code.google.com/p/android/issues/detail?id=8816

If you're having issues using the GeoCoder on lower APIs you should check the stacktrace. From time to time I'm having the following :

java.io.IOException: Unable to parse response from server
at android.location.Geocoder.getFromLocation(Geocoder.java:124) 

This can be anything from a server-side issue at Google, or an issue on the client (internet connection).

If the GeoCoder returns an empty list, you need to check if you have a proper GeoCoder implementation available on the device (emulator or real phone).

This can be done using the isPresent() method on the Geocoder object.

http://developer.android.com/reference/android/location/Geocoder.html

Also, when running on an emulator, make sure your AVD image is setup with the Google APIs.



来源:https://stackoverflow.com/questions/6894533/geo-coder-error

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