Places Android KTX là một tập hợp các tiện ích của Kotlin dành cho SDK Địa điểm dành cho Android. Các tiện ích này cung cấp các tính năng ngôn ngữ Kotlin cho phép bạn viết mã Kotlin ngắn gọn và phù hợp khi phát triển cho SDK Địa điểm dành cho Android.
Places KTX là mã nguồn mở và có sẵn trên GitHub cùng với các ví dụ.
Cài đặt KTX cho SDK Địa điểm
Để cài đặt KTX cho SDK Địa điểm dành cho Android, hãy thêm các phần phụ thuộc sau vào tệp build.gradle.kts cấp ứng dụng.
dependencies{// KTX for the Places SDK for Android libraryimplementation("com.google.maps.android:places-ktx:3.3.1")}
Dùng thử ứng dụng mẫu
Kho lưu trữ GitHub cho thư viện này cũng chứa một ứng dụng minh hoạ cho biết cách bạn có thể sử dụng thư viện Places KTX trong ứng dụng của riêng mình.
Để dùng thử ứng dụng minh hoạ, hãy làm theo các bước sau:
[null,null,["Cập nhật lần gần đây nhất: 2025-02-25 UTC."],[[["Places Android KTX offers Kotlin extensions for streamlined Places SDK interaction using idiomatic Kotlin."],["Native Kotlin APIs within the Places SDK for Android (version 4.0.0 and later) can be used as an alternative to Places Android KTX extensions."],["Developers can easily integrate Places KTX by adding the specified dependency to their app's `build.gradle.kts` file."],["A demo application within the GitHub repository provides practical examples of utilizing the Places KTX library."]]],["Places KTX provides Kotlin extensions for the Places SDK for Android, enabling concise Kotlin development. Install it by adding the `com.google.maps.android:places-ktx:3.3.1` dependency to your app's `build.gradle.kts` file. A demo app is available on GitHub; to run it, clone the repository, obtain a Places API key, and store it in a `secrets.properties` file in the root directory. Select and Run the **app-places-ktx** module in Android Studio. The Places SDK also offers native Kotlin APIs as of version 4.0.0.\n"]]