Reputation: 4736
I am trying to develop an app which can display the schools and airports in the locality. I found that using Google Places API is the way to go.
I have seen the documentation here... Can anyone explain how to use the API?
Upvotes: 22
Views: 37609
Reputation: 6992
Google places API which was provided as part of google play services is deprecated. Google provided new version of Places SDK for android.
The new version doesn't support place picker. You can migrate old code in your app to new version by following instructions documented here https://developers.google.com/places/android-sdk/client-migration
With new version, you can specify filters for results and fields to be present in the response. See below tutorial with examples to know how to use new places sdk for android, http://www.zoftino.com/google-places-sdk-for-android-tutorial
Upvotes: 0
Reputation: 7257
New tutorial available
It appears that the original tutorial by Brian is now 404, so here is a link to the Google one in case people see this answer first.
https://developers.google.com/places/android-api/current-place-tutorial
When this article was first written this tutorial didn't exist.
Original:
You could try this tutorial (now 404): http://blog.brianbuikema.com/2010/08/android-development-part-1-using-googles-places-api-to-develop-compelling-location-based-mobile-applications/
Upvotes: 4
Reputation: 3814
The point is that you have to build the URL, create the HttpRequest and get the data in XML or JSON format. After that, you may parse this data to get the information you want. Most of people do it in each use, but I think the best option is to have an API for that purpose.
I have developed an API which builds the URL, connects and gets the data in a list of objects that represent places in a well structured OOP design. And everything happen in background in an AsyncTask, which returns the information through an interface/listener. https://github.com/perezdidac/google-places-api.
Upvotes: 0
Reputation: 1138
You will have to get familiar with HttpClient, HttpRequest, and HttpResponse if you're not already.
Very simply:
Step 1) build your uri with your api key and search terms as per google's syntax
Step 2) perform a post using that uri
Step 3) decode the response from the post
Happy coding :)
Upvotes: 1
Reputation: 22603
You can find a tutorial on the Places API in a J2SE environment, using the Google APIs Client Library for Java on my blog. It also includes a sample application in Github that might get you started.
If should be fairly easy to port to Android, as the Google APIs Client Library for Java is Android compatible.
Upvotes: 3