Android Google Places Get Nearby Places (Google Play 15)

July 22, 2018

You need Places SDK for Android to get places data.

Setup Google Play Services

Edit build.gradle (Module)

dependencies {
    // implementation ""
    implementation ""

NOTE: Set Up Google Play Services

Add your API key

NOTE: If you already setup Android Google Maps, this step is already done.

Edit AndroidManifest.xml

<manifest ...>
    <application ...>
            android:value="YOUR_API_KEY" />

Refer to Get API Key and Signup or Get API Key.

NOTE: You can refer to Android Google Maps for some setup guidance as well.

Get Nearby Places

val placeDetectionClient = Places.getPlaceDetectionClient(context)

val task = placeDetectionClient.getCurrentPlace(null)

// val result = Tasks.await(placeResult)
placeResult.addOnCompleteListener { task ->
    val result = task.result

    for (placeLikelihood in result) {
        val place =

        //,, place.address, place.placeTypes, place.latLng


Refer to Current Place.

NOTE: Sadly there is no way to find nearby places by specifying a specific location. You can search at particular location using autocomplete, but a query string is required.

Display attributions

To use google places without a Map, you need display attributions.

To display “Powered by Google” drawable in TextView

val attributionText = SpannableStringBuilder(" ").apply {
    setSpan(ImageSpan(context, R.drawable.powered_by_google_dark), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
textView.text = attributionText

You need to display third-party attributions as well.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.