Reputation: 473
Following the line of code throwing: grpc failed error yesterday.but today it's working fine.
List<Address> addresses=geocoder.getFromLocation(location.getLatitude(),location.getLongitude(),1);
can somebody please explain?
Upvotes: 1
Views: 1850
Reputation: 32110
It looks like native Geocoder of Android API periodically experiences this issue. It was reported to Google some time ago, but looks like the issue wasn't solved definitely:
https://issuetracker.google.com/issues/64418751
Feel free to star this bug to add your vote.
As an alternative you can consider switching to Geocoding API web service that seems to be more reliable. You can use the Java client library for Google Maps API Web Services to implement web service calls from your Android app:
https://github.com/googlemaps/google-maps-services-java
This library has reverse geocoding function similar to getFromLocation. Check the javadoc for more details:
https://googlemaps.github.io/google-maps-services-java/v0.2.5/javadoc/
I hope this helps!
Upvotes: 2