Geocoder.getFromLocation throws IOException on Android emulator
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.
Geocoder.getFromLocation throws Exception
Do note that when you call that method, it fires off an API call to Google Maps' servers - it isn't doing it on the device. I suspect this is an error you will see sometimes, because the method is not managing to get a meaningful response from the Google Maps API. I've used this method and I occasionally see that error, but I usually put the method into a loop of 10 retries, and quietly ignore the occasional error. If it's happening every time you call the method, there's something odd happening
in android i'm getting IOException in Geocoder
It seems to be a prob faced by many. Check this.
You can try using GeoCoding APIs if using Geocoder doesn't work out even if internet connection is there.
Android Geocoder.getLocationFromName() throws IOException: Service not available on Device
Make sure your application's build target is set to one of the Google APIs and not simply Android 4.0 (or similar). You can change this setting in Eclipse by right-clicking on your project and selecting "Properties" then "Android." Alternatively, you can simply edit the project.properties
file to something like the following:
# Project target
target=Google Inc.:Google APIs:16
The reason is that the Geocoder
class is present in the core Android framework, but depends on code contributed by the Google APIs to function properly. Even if your AVD includes the Google APIs, your project still needs to be built against that specific build target.
Geocoder.getFromLocation grpc failed on Android real device
It looks like this is ongoing issue that was reported in the Google issue tracker both for real devices and emulators. You can refer to the following bugs:
https://issuetracker.google.com/issues/64418751
https://issuetracker.google.com/issues/64247769
Unfortunately, Google haven't solved these issues yet.
As a workaround you can consider using the Geocoding API web service. Please note that there is a Java client library for web services that you can find on Github:
https://github.com/googlemaps/google-maps-services-java
Using Java client library for web services you can implement reverse geocoding lookup that shouldn't give you the error that you experience with native Android geocoder.
The Javadoc for client library is located at
https://googlemaps.github.io/google-maps-services-java/v0.2.5/javadoc/
I hope this helps!
Android 4.1 Geocoder.getLocationFromName() throws IOException: Unable to parse response from server ONLY over 3G
Instead of using that GeoCoder, use google's web api, you can make asynchronous api calls to that and get json objects with even more information than the android geocoder will ever give you.
it is better https://developers.google.com/maps/documentation/geocoding/
I've done this in several android apps and this also guarantees that you will get the same kind of results from crossplatform apps
Related Topics
Creating a Directory in /Sdcard Fails
Android: Programmatically Detect If Device Has Hardware Menu Button
How to Make Notification Intent Resume Rather Than Making a New Intent
How to Build an Android Library with Android Studio and Gradle
How to Make a View with Rounded Corners
How to Customize Item Background and Item Text Color Inside Navigationview
How to Build Signed APK from Android Studio for Flutter
Android - Timepicker Minutes to 15
How to Implement a Listview Without Listactivity? (Use Only Activity)
How to Create Custom Baseadapter for Autocompletetextview
How to Find MAC Address of an Android Device Programmatically
Android: How to Select Texts from Webview
How to Get Available Wifi Networks and Display Them in a List in Android
Android: Http Communication Should Use "Accept-Encoding: Gzip"
Android Notification Is Not Showing
How to Set Default App Launcher Programmatically