java.io.IOException: grpc failed
I can reproduce this issue (java.io.IOException: grpc failed), when there is no Internet connection on my real device.
I can reproduce this issue (java.io.IOException: grpc failed), when there is no Internet connection on my real device.
I had a similar problem and found that polling the Geocoder until i got a result worked. Here is how i did it, so far works great. try { List<Address> geoResults = geocoder.getFromLocationName(“<address goes here>”, 1); while (geoResults.size()==0) { geoResults = geocoder.getFromLocationName(“<address goes here>”, 1); } if (geoResults.size()>0) { Address addr = geoResults.get(0); myLocation.setLatitude(addr.getLatitude()); myLocation.setLongitude(addr.getLongitude()); … Read more
The common answer to this problem is that you have to restart your device. Surely you cannot tell your users to restart device in order for your app to function, so my solution was to use a HTTP fallback, here is the AsyncTask I use in my code. You will have to modify it for … Read more
Probably you are sending too many requests per second and Google doesn’t let you do that. Read http://code.google.com/apis/maps/faq.html#geocoder_classorhttp
Use the GeoCoding API For example, to lookup zip 77379 use a request like this: https://maps.googleapis.com/maps/api/geocode/json?address=77379&sensor=true&key=YOUR_GOOGLE_PLATFORM_API_KEY
There is a problem recently with android devices and the geocoder not working: http://code.google.com/p/android/issues/detail?id=38009 A reboot seems to fix the issue
Here are two options, one using sf and one using sp package functions. sf is the more modern (and, here in 2020, recommended) package for analyzing spatial data, but in case it’s still useful, I am leaving my original 2012 answer showing how to do this with sp-related functions. Method 1 (using sf): library(sf) library(spData) … Read more
I asked Google’s Reto Meier to confirm my theory was correct and he said “Correct. The Geocoder is part of the Google API add-on that isn’t part of the AOSP.” So any device that doesn’t come with the Play Store, GMail apps etc… will also be missing the Geocoder back-end.
The actual reason why Geocoder was not working is because the NetworkLocator was killed in action. Probably due to less memory or maybe you used the Task Manager to kill all services? I’m not sure but this is a guess. I’ve seen this before. Last year I wrote a reconnect mechanism to load the NetworkLocator.apk … Read more
public GeoPoint getLocationFromAddress(String strAddress) { Geocoder coder = new Geocoder(this); List<Address> address; GeoPoint p1 = null; try { address = coder.getFromLocationName(strAddress, 5); if (address == null) { return null; } Address location = address.get(0); location.getLatitude(); location.getLongitude(); p1 = new GeoPoint((double) (location.getLatitude() * 1E6), (double) (location.getLongitude() * 1E6)); return p1; } catch (IOException e) { e.printStackTrace(); … Read more