Using Google Place Picker For Android

One of my recent projects had an interesting requirement.  It was an Android application and it needed to be aware of any businesses that were near the user’s current location.  If you have ever used Facebook’s or FourSquare’s “Check-In” feature, it’s very similar.  The user had to tap a button, and bring up a list of all business that were near the user.  The user would then choose a business (location), and then display the business’s Name, Address, City, State, Latitude, Longitude, etc.

When researching this functionality, I stumbled along the Google Places API.  Upon examining the Google Places API, I noticed the PlacePicker widget.  This is an out of the box widget that you can display programmatically and it will give you a beautiful Location Picker user interface similar to the Google Maps app for Android.

This meet my requirement, and then some.  Not only did it give me a list of businesses that were near my user’s location, it also gave me a material design user interface that my users could interact with.  That was an added bonus since I didn’t need to create a UI for this.  I could just use the out of the box control and be done with it.  To top it off, using the PlacePicker was easy!  And on this post, I’m going to show you how to add it to your Xamarin.Android applications.

First Things First

The first thing you need to do before you start writing code is to acquire a Google Maps v2 API Key.  If you already have one for your application, then great!  Use that one!  If not, you’ll have to acquire one.  They are free, and there are a number of steps you have to perform in order to get one.  Luckily, Xamarin has some detailed documentation on how to get one.  So I recommend that you read that.

Next you want to download the latest Android SDK Tools and Google Play Services SDK from the Android Device Manager.  I’m not quite sure what minimum versions you’ll need.  But if you have a relatively recent version, then it should work.  If not, just download the latest versions from the Android SDK Manager.  If you need details on how to do that, I discuss this in the video below.

High Level Step By Step

I go into great detail in the video below, but as a reference here is what we’re going to do:

  1. Acquire a Google Maps v2 API Key.
  2. Download the latest, or have a relatively later version, of the Android SDK Tools and Google Play Services API.
  3. Create an instance of PlacePicker.IntentBuilder.
  4. Use StartActivityFromResult to launch an intent from your Place Picker Intent Builder.
  5. Override OnActivityResult so that the PlacePicker control can return data back to us.
  6. Get the Place that the user picked from the PlacePicker.
  7. Populate our UI from the Place object that the user chose.

That’s pretty much it at a high level.  You can download the completed source code on my GitHub page here.  Of course, a video is worth a million words!  Watch the video and you can see the step by step details how to call the built-in PlacePicker control.

Feel free to leave a comment and let me know what you think!


  • Pingback: Ruben Macias: Using Google Place Picker For Android – XamGeek.com()

  • Pingback: Adam J Wolf: Weekly Xamarin Newsletter Issue #88 – XamGeek.com()

  • Pingback: Xamarin Link Roundup – 11 May 2016 — Kym Phillpotts()

  • Gizem

    Hi, i am trying this tutorial and i get this errors : error: package com.google.android.gms.location does not exist
    com.google.android.gms.location.LocationListener HappyTravelGuide17 C:UsersGizemDesktopHappyTravelGuide17HappyTravelGuide17objDebugandroidsrcmd5c3f794aca97c55dc0e6d5992e563f700LocationListener.java 8

    error: package com.google.android.gms.location does not exist
    com.google.android.gms.location.LocationListener HappyTravelGuide17 C:UsersGizemDesktopHappyTravelGuide17HappyTravelGuide17objDebugandroidsrcmonocomgoogleandroidgmslocationLocationListenerImplementor.java 8

    What should i do, thank you.

  • Christophe BERNARD

    Hello thanks for this excellent article that’s nice to help me to understand how works place picker …thanks really ! but is it possible to filer the result ? i would like to filer only restaurant , coffee shop or anything else .. thanks for all your dev :)

  • Pingback: 10 SECRET Google Earth Places You’re NOT Allowed To See – Twenty Gadgets()

  • Pingback: 5 Secret Places Censored on Google Maps – Three Gadgets()

  • Pingback: Using Google Place Picker For Android | Coding Tweaks()

  • Tarun Ohri

    Hi, Thanks for sharing this article. But i am facing one issue while running it. On clicking “Pick a Place”, the google map appears for few seconds and then goes off automatically. Why this can be so ? Please suggest. Thanks!

  • Tarun Ohri

    Hi, now i am able to run the application in the emulator but on device the problem still persists. I tried changing API key plenty of times but that doesn’t help. Still google map appears for few seconds and disappears on android device. Please guide me where i am going wrong. Thanks!