2

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.

1

1 Answer 1

2

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):

No Use of Content without a Google Map. You must not use or display the Content without a corresponding Google map, unless you are explicitly permitted to do so in the Maps APIs Documentation. In any event, you must not use or display the Content on or in conjunction with a non-Google map. For example, you must not use geocodes obtained through the Service in conjunction with a non-Google map. As another example, you must not display Street View imagery alongside a non-Google map, but you may display Street View imagery without a corresponding Google map because the Maps APIs Documentation explicitly permits you to do so.

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.

2
  • 1
    Yes Android Geocoder actually does the job...thankyou...but what does it invoke behind the scenes to figure out address??
    – Jasper
    May 8, 2015 at 4:56
  • The actual Android geocoding service implementation is abstracted out of the Android Open Source Project (AOSP) code (see stackoverflow.com/a/21860496/937715), so the implementation is up to the OEM of the Android device. My guess is that most official Android devices blessed by Google use the Google Maps Geocoding API behind the scenes, but there is no way to know for sure. You could try to sniff the logs to see what a particular device is doing, but there is no guarantee that other Android devices use the same service. May 8, 2015 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.