Android Google Places Get Nearby Places (Google Play 15)

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    }    result.release()}

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.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.