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 along with examples.
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
file.
dependencies {
implementation 'com.google.maps.android:places-ktx:0.4.0'
}
If you are using the Places static library with Maps SDK V3 BETA,
add the following dependency to your app-level build.gradle
file instead.
dependencies {
implementation 'com.google.maps.android:places-v3-ktx:0.4.0'
}
Try the sample application
The GitHub repository for this library also contains a demo application that shows how you can use the Places KTX library in your own app.
![]() |
![]() |
To try the demo application, follow these steps:
- From GitHub, clone the or download the ZIP file.
- In Android Studio, choose File -> Open and navigate to the directory and open the folder that you just cloned or downloaded.
- Add an API key to the demo app.
- Get a Places API key.
- In the root directory, create a file called
secure.properties
. This file should NOT be under version control to protect your API key. - Add this single line to
secure.properties
PLACES_API_KEY=”YOUR_API_KEY”
whereYOUR_API_KEY
is the actual API key you obtained in the first step. You can look at thesecure.properties.template
as an example. - Under the run configuration, select the module app.
- Select Run ‘app’.