Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Geocoding API vs Geocoder

In my application I need to use the geocoding, but I am not quite clear which method to use. Until yesterday I added the parameters to the URL maps.googleapis.com/maps/api/geocode/json?address=myparameter&sensor=false, but Google blocked my requests for a day, making the application crash because it did not return any results from the request for geocoding.

Now I am using the Geocoder class that does the same thing and also I have seen that you can create and use an API key for Geocoding.
Which method do you recommend to use? What is the difference between the two methods, apart from the limitations of the requests?

like image 533
itc.opra Avatar asked May 22 '26 16:05

itc.opra


2 Answers

Geocoder is a built-in API in the Android framework that is free. Geocoding API is a rest API that is paid. Geocoder uses a different search stack internally and this leads to different results comparing to the Geocoding rest API. The Geocoding rest API works better than Geocoder normally but has usage limits and the implementation is bigger.

like image 99
Sachin Singh Avatar answered May 24 '26 06:05

Sachin Singh


Geocoder API is built into the system and it's easy to use. From my experience, it's working in most cases, although:

  • in some cases it fails and throws grpc failed IOException
       Non-fatal Exception: java.io.IOException: grpc failed
       at android.location.Geocoder.getFromLocation(Geocoder.java:136)
  • it may not be even available on some devices (use isPresent() method to verify this).

With above, I don't think Geocoder API is super reliable, so if geocoding is a critical part of your app, you may look into other options (like Google's Geocoding API, which is not free).

like image 20
Myroslav Avatar answered May 24 '26 06:05

Myroslav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!