In my Android App I need to figure out what address i.e city, state, country my Android phone is in.
So for that, first I determine latitude, longitude via GPS. The phone gives this.
Now, from lat, long I need to determine the address as follows (probably called reverse geocoding):
http://maps.google.com/maps/api/geocode/json?latlng="+ latLng
This works and gives me the address with city, state, country etc. All fine.
Does this break any Google licensing requirements since I am not using any maps and I only need the location address?
If so, how else can I determine the address where an Android phone is.
Best Answer
Yes, using the server-side Geocoding API without displaying the results on a Google Map violates Google's Maps API Terms-of-Service.
From Section 10.1.1(h):
One alternative on Android is the Android Geocoder, which doesn't have that terms-of-service restriction. The
Geocoder.getFromLocation()
method takes in a latitude and longitude and returns a list of possible address matches. Another benefit of the Android Geocoder is that there are no usage limits. I created a sample Android Geocoder app on Github that you can feel free to use (licensed under Apache 2.0) (an aside - I created the app originally to demo a bug on Android that's since been fixed).There are also other alternatives. You might want to check out the OpenTripPlanner for Android app on Github that our group has worked on - we support multiple geocoders (including the MapQuest Nominatim API), as discussed in the OTPGeocoding wiki. Here's the code for the OTPGeocoding task, and the utility method that actually makes the calls.