Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
500 views
in Technique[技术] by (71.8m points)

android - geocoder.getFromLocation function throws "Timed out waiting for server response" exception

I am trying to get location of user by starting IntentService from MainActivity. Inside the service i try to reverse geocode the location inside a try block but when i catch the exception and print it says "Timed out waiting for server response" exception.But a few times I have got the location.so i think there is nothing wrong with my code.But it won't be useful if it throws exception 8 times out of 10.So can you suggest some thing to avoid this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

http://maps.googleapis.com/maps/api/geocode/json?latlng=lat,lng&sensor=true

Geocoder having the bug of time out waiting for server response .In alternate to that you can hit this request from your code to get the json response of location address of respective lat,lng.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...