Geocoding API vs Geocoder

半世苍凉 提交于 2019-12-06 07:04:22

If you need to use a map in your app, you should use the API called: Google Maps Android API v2.

If you need to manage geocoded data (address to lat/lng or viceversa) then enable Geocoding API and start using the class Geocoder.

For example (lat/lng to address):

Geocoder geocoder = new Geocoder(this, Locale.getDefault());
addresses = geocoder.getFromLocation(gps.getLatitude(),  gps.getLongitude(), 1); 

Users of free API have following limits:

  • 2,500 requests per 24 hour period.
  • 5 requests per second.

You can include API key in web-request also like:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API_KEY

Not sure about android Geocoder class, maybe someone else can help you out in that matter. But i assume same limits would apply.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!