We are currently developing an Android app in which we use google map. We need to get the city and province of a given lon-lat. My question is if calling the reverse geocoding service like
"http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false" from the app is prohibited or not.
It is not prohibited, but it's rate limited and subject to usage limitations from google's API.
You should probably estimate your usage and check if you will not go over the free quota provided
You can definitely use the web API, and it doesn't appear to be tracked. There is also a built in Android Geocoder, but it has an issue where it occasionally returns an IOException for no apparent reason.
Related
I have run into a Problem.
Basically, google web services allows a maximum amount of 1000 requests per day unless you verify your credit card (which I as a student, don't have).
I am building an android application which will help you find food near you and give you tips and whatnot. But heres the problem. I have reached the daily cap multiple times just due to testing the app & debugging it... And that is a serious issue...
I know how SQLite databases & so on work, and how to use them, but is that the way one would go when using google places web services? Is that even allowed?
Here is the basic process of what is happening:
Open App & Get the users location
Search and Mark nearby food sources (restaurants & whatnot)
This is done via getting a HTTP request with "Place Search"
Place search itself deliveres little information, not enough, so I get a "Detail Search" for every place it finds.
All the results (Max. 60) are marked on the map and saved in a DataHolder class storing all the DataModel classes.
this works fine and as intended, also if I close and restart the app, it will "work". But it will redownload all the data and the details. As you can imagine, this busts my 1000 request limit pretty damm fast.
So is there a common practice/structure on how developers persist this "Google API" data? I feel the way im doing it very inefficient both for me and the user...
Thanks.
If you are developing a web based application that only needs to search for places, and does not submit new places, you should use the Places Library of the Google Maps Javascript API rather than the Google Places API Web Service. The Places library assigns a quota to each end user rather than to each key. This means that your available quota increases with your user base rather than being capped at a fixed amount.
You can use Places API for Javascript https://developers.google.com/maps/documentation/javascript/places
It has all features of server version. You could try to use it with invisible WebView, or better with Rhino.
I have implemented google location search like OlaCabs app but it is not as fast in searching as OlaCabs do.Reason behind it is I need to hit a rest api (Google Place api) to find locations as per text search. I noticed that in olacab app there is some text showing "powered by Google"(Look screen below).So I just want to know:
1.Is there any api provided by google for android rather than rest api ?
2.If OlaCaps using some paid google search API then what is it and form where can I buy it?
You seem to be looking for Google Places Autocomplete API
Most of Google APIs are free till some courtesy limit (different for each API) and paid afterwards. Courtesy limits are higher if you have given your credit card info. Still if you are beyond free limit, you should consider paying for them.
You are in search of Google places autocomplete.
I figured Google has the Place Autocomplete service using which I can allow the user to type in a city name which’ll fetch all the cities containing that string from Google’s servers that can be presented in an AutoCompleteTextView.
Link :
*http://codetheory.in/google-place-api-autocomplete-service-in-android-application/
Hope it will* help you.
I am devoloping an app that let the user know its location. I am using this example
But I also seen here that "The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited". So I cannot use Geocoder without displaying the result on the map?
Geocoder, the class that you use which, for Android is under the package:android.location.Geocoder.
That is different from Google Geocoding API:
https://developers.google.com/maps/documentation/geocoding/?hl=fr
for which we'd use the url:
http://maps.googleapis.com/maps/api/geocode/output?parameters
There is a GeoCoder class for javascript which is related to the Google Geocoding API which is the Geocoder class of the Google Maps API v3.
(searching for which takes us to: https://developers.google.com/maps/documentation/javascript/services?hl=fr#Geocoding)
So when there is reference to "The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited."
It would be for the API and related class of the v3 API, not the android.location.Geocoder.
Also, i would like you to know about:
https://code.google.com/p/android/issues/detail?id=8816
I have faced that one.
Actually, you can use Geocoding API, there is no limit. See my last answer
Get current location using json
TLDR: You should be fine.
The content that you are referencing is indeed for Google's REST API's and states:
The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.
This will not affect the use of the Android as far as I am aware. Referencing this answer it seems that:
Therefore there is no hard limit on the the Android GeoCode API useage, more just a fair useage policy per device (client)
From the TOS:
(a) Free Access (No Fees). Your Maps API Implementation must be generally accessible to users without charge and must not require a fee-based subscription or other fee-based restricted access. This rule applies to Your Content and any other content in your Maps API Implementation, whether Your Content or the other content is in existence now or is added later.
However:
(b) Mobile Applications.
(i) The rule in Section 9.1.1(a) (Free Access) does not apply if your Maps API Implementation is used in a mobile application that is sold for a fee through an online store and is downloadable to a mobile device that can access the online store.
(ii) The rule in Section 9.1.1(b) (Public Access) does not apply if
your Maps API Implementation is an Android application that uses the
Google Maps Android API. (However, the rule in Section 9.1.1(b)
(Public Access) will continue to apply if your Maps API Implementation
is an Android application that uses any other Maps APIs, unless the
Maps API Implementation qualifies for the exception in Section
9.1.2(a) (Enterprise Agreement with Google).)
I've always found the TOS a bit difficult to grasp myself and have ended up contacting Google. While they've always been perfectly amicable it has sometimes taken some time for a response. I hope this helps clear this up for you and anyone else that comes across it.
You can use the Android Geocoder without needing to display the results on the map.
The geocoding service for Android is abstracted from any particular server-side implementation and is dependent on the OEM implementing this feature in the device. In the above documentation, it says:
The Geocoder class requires a backend service that is not included in the core android framework. The Geocoder query methods will return an empty list if there no backend service in the platform. Use the isPresent() method to determine whether a Geocoder implementation exists.
In other words, the Android Open-Source Project includes only a proxy class for the Geocoder service, a base abstract GeocoderProvider to be implemented, and an an interface for location providers implementing the Geocoder services - not the actual Geocoder service implementation.
So, when your app is running on a device, it may be accessing any number of geocoding providers when using the Android Geocoder API, depending on how that particular OEM implemented the service on that particular device. Google may have an agreement with some OEMs to provide these services via their own web-based Geocoding API, but this agreement does not involve you as a developer and would not force the web-based Geocoding API Terms of Service on you (since you have no way of knowing whether or not your app is actually using a Google service).
According to this Google document there are limits on using Distance matrix web service.
From the document :
Use of the Distance Matrix API must relate to the display of information on a
Google Map.Use of the service in an application that doesn't display a Google map
is prohibited.
I am not clear whether I meet this limit or not.
Let me explain how I use this web service. I call this api from server to get distance between locations. Using this distance I just decide that user1's entered location is near to user2's entered location or not. I don't use this information to display on google map. But at client side I display google maps with marker for user's entered location and markers for nearby users' location.
Using web service and google maps this way, do I satisfy the above mentioned limit?
Note : I also call direction web service at client-side to display routes on map.
MAPS API
Your usage is fine. I think the whole point of the Google guidelines you quoted above are to stop people using the distance matrix and other Google Maps APIs (without a Google MAPS API business account) from using it outside of any "app" scope for financial gain or in situations where there is a simpler solution that doesn't require their API. (I will get to this soon)
This is also the reason they impose lower limits on the numbers of API calls you can make per day when using a free Google Maps key:
Normal - 2 500 elements per 24 hour period.
Business - 100 000 elements per 24 hour period.
I've used many of the Google maps API services on free accounts across a broad range of applications, some that match the scenario you have state above, others that do not. We have never had a problem at all and as long as people use the API fairly, they shouldn't either.
Other ways
There are other ways of doing what you require. You could calculate the distance between the two locations using the Haversine Foruma
http://en.wikipedia.org/wiki/Haversine_formula
and then send this distance down to your app upon request. This would remove the need for the Distance Matrix API in some circumstances (I'm unsure how indepth your App and Web Services actually are).
Why not instead use straight line distance between two points?
Try to find something similar to Android's Location.distanceBetween in the language you use for your server or just port the code from Android.
I'm using Services do calculating the LatLng from some addresses stored in a database. When I have a lot of addresses, it's slower to calculate and when I open Google Maps, it doesn't have all the Markers displayed on the screen, because the Service is still calculating in background. Is there a way to Markers appear automatically with the Maps still opened?
Thanks!
You should probably geocode the data when it is entered into the database instead of at the time it is displayed. As you have seen, geocoding is slow, and it would be better to cache the geocoded results. Or at least save the geocoded result the first time you encounter an address.
Note: Google has restrictions on what you can use its geocoding service for. If you used Google's geocoding, then you are only allowed to use that lat/lng with the Google Maps API.
There do exist free/open source geocoders. In my opinion/experience, Google's geocoders is better than the open source ones. (But it has restrictions.)