22

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?

Laurel
  • 5,965
  • 14
  • 31
  • 57
Rahul Kalidindi
  • 4,666
  • 14
  • 56
  • 92
  • 2
    any advances? i too am looking for developing similar apps and found out google places is as you mentioned the solution. maybe you could fill me in on the progress, andp.46@gmail.com – anuguy Feb 24 '11 at 01:36
  • There's a video from Google I/O 2011 about how to use the places API here: http://www.youtube.com/watch?v=nuDgC7RspsQ – Joshua Carmody Apr 20 '12 at 00:41

5 Answers5

4

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/

Gary
  • 7,167
  • 3
  • 38
  • 57
  • Thanks for the link but the implementation of places near our proximity is still pending in the tutorial... Can u plz post any other sources? – Rahul Kalidindi Oct 27 '10 at 06:04
  • @Rahul glad to help, but this is the only tutorial I know of. Perhaps it would be worth contacting the author directly, or maybe offering a bounty against this question to entice others to work on it. – Gary Oct 27 '10 at 07:47
  • Please check link outdated – Daniele Apr 15 '17 at 19:23
  • @Daniele Thanks for letting me know. I've updated to a different one. – Gary Apr 19 '17 at 16:07
3

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.

ddewaele
  • 22,363
  • 10
  • 69
  • 82
  • You might want to make it clear that you are linking to what appears to be your blog. Otherwise people will mistake this as spam (which I was very close to flagging). – Jeff Mercado Jun 03 '11 at 09:32
  • I edited the question. Is that ok ? Is there a rule against posting links in answers ? The link contains exactly what the user was requesting (the use of the API , a tutorial + sample). – ddewaele Jun 03 '11 at 10:51
  • 1
    Oh no, there's nothing wrong with posting links, just as long as they're on-topic and self-promotion is properly disclosed. See the relevant section in [the faq](http://stackoverflow.com/faq#promotion) and also to get an idea of the problems in can cause, [this discussion](http://meta.stackexchange.com/questions/86717/defining-the-limits-of-self-promotion). – Jeff Mercado Jun 03 '11 at 10:59
1

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

tricknology
  • 1,092
  • 1
  • 15
  • 27
0

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.

Didac Perez Parera
  • 3,734
  • 3
  • 52
  • 87
  • is there any tutorial on how to use this api ? –  Apr 07 '14 at 07:06
  • No... I am sorry. But you can create a GooglePlaces object passing to the constructor an implementation of the interface PlacesListener which will notify you when you have the response via the onPlacesReceived method. Just call GooglePlaces.query() passing a PlacesQuery object with your request. It's really easy :) best of luck – Didac Perez Parera Apr 07 '14 at 12:36
0

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

Arnav Rao
  • 6,692
  • 2
  • 34
  • 31