[Video](https://www.youtube.com/watch?v=2XoAGd8PKJU)

Places Android KTX is a collection of Kotlin extensions for the
Places SDK for Android. These extensions provide Kotlin
language features that enable you to write concise and idiomatic Kotlin when
developing for the Places SDK for Android.
Places KTX is open-sourced and available on
[GitHub](https://github.com/googlemaps/android-places-ktx)
along with examples.

> [!NOTE]
> **Note:** As of [version
> 4.0.0](https://developers.google.com/maps/documentation/places/android-sdk/release-notes), the Places SDK for Android includes native Kotlin APIs that can be used instead of the Places Android KTX extensions. For more information, see the Places SDK for Android [Reference
> Overview](https://developers.google.com/maps/documentation/places/android-sdk/reference).

## Install KTX for the Places SDK

To install KTX for the Places SDK for Android, add the
following dependencies to your app-level `build.gradle.kts` file.

```
dependencies {

    // Modern Android projects use version catalogs to manage dependencies. To include the Places SDK for Android,
    // first add the following to your gradle/libs.versions.toml file:
    //
    // [versions]
    // places = "5.3.0"
    //
    // [libraries]
    // places = { group = "com.google.android.libraries.places", name = "places", version.ref = "places" }
    //
    // Places SDK for Android (Kotlin extensions and coroutines are built directly into the Places SDK)
    implementation(libs.places)

    // If your project does not use a version catalog, you can use the following dependency instead:
    //
    //    implementation("com.google.android.libraries.places:places:5.3.0")
}
```

## Try the sample application

The GitHub repository for this library also contains a [demo
application](https://github.com/googlemaps/android-places-ktx)
that shows how you can use the Places KTX library in your own app.

|---|---|
| ![First screen of the Places KTX sample app, showing your choices](https://developers.google.com/static/maps/documentation/places/android-sdk/images/places-ktx-demo-1.png) | ![Places Search Demo app screen](https://developers.google.com/static/maps/documentation/places/android-sdk/images/places-ktx-demo-2.png) |

To try the demo application, follow these steps:

1. From [GitHub](https://github.com/googlemaps/android-places-ktx), clone the or download the ZIP file.
2. In Android Studio, choose **File -\> Open** and navigate to the directory and open the folder that you just cloned or downloaded.
3. Add an API key to the demo app.
   1. [Get a Places API key](https://developers.google.com/maps/documentation/places/android-sdk/get-api-key.md.txt).
   2. In the root directory, create a file called `secrets.properties`. This file should NOT be under version control to protect your API key.
   3. Add this single line to `secrets.properties`  

      ```
      PLACES_API_KEY="YOUR_API_KEY"
      ```
      where `YOUR_API_KEY` is the actual API key you obtained in the first step. You can look at the [`local.defaults.properties`](https://github.com/googlemaps/android-places-ktx/blob/main/local.defaults.properties) as an example.
4. Under the run configuration, select the module **app-places-ktx**.
5. Select **Run 'app-places-ktx'.**