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.kts
file.
dependencies { // KTX for the Places SDK for Android library implementation("com.google.maps.android:places-ktx:3.2.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
secrets.properties
. This file should NOT be under version control to protect your API key. - Add this single line to
secrets.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 thelocal.defaults.properties
as an example. - Under the run configuration, select the module app-places-ktx.
- Select Run 'app-places-ktx'.