Maps Rx 程式庫可讓您在 Maps SDK for Android 和 Places SDK for Android 中接收非同步事件的可觀察序列,以便充分運用豐富的 RxJava 功能。
安裝
如要在 Google 地圖專案中安裝 Maps Rx 程式庫,請按照下列步驟操作:
將以下依附元件加進模組層級 build.gradle 檔案:
dependencies {
// RxJava bindings for the Maps SDK
implementation 'com.google.maps.android:maps-rx:1.0.0'
// RxJava bindings for the Places SDK
implementation 'com.google.maps.android:places-rx:1.0.0'
// It is recommended to also include the latest Maps SDK, Places SDK and RxJava so you
// have the latest features and bug fixes.
implementation "com.google.android.gms:play-services-maps:19.0.0"
implementation 'com.google.android.libraries.places:places:3.5.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.8'
Observable.merge(
googleMap.cameraIdleEvents(),
googleMap.cameraMoveEvents(),
googleMap.cameraMoveCanceledEvents(),
googleMap.cameraMoveStartedEvents()
).subscribe {
// Notified when any camera event occurs
}
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-13 (世界標準時間)。"],[[["The Maps Rx library enables the use of RxJava with the Maps SDK and Places SDK for Android to handle asynchronous events."],["It provides observable sequences for events like marker clicks and camera movements, allowing developers to leverage RxJava features."],["You can install the library by adding specific dependencies to your `build.gradle` file and rebuilding your project."],["The library offers extension functions and operators to simplify the integration of RxJava with Google Maps functionality."]]],["The Maps Rx library, designed for use with RxJava, allows developers to receive observable sequences for asynchronous events on the Maps SDK and Places SDK for Android. To install, add dependencies for `maps-rx`, `places-rx`, and the latest `Maps SDK`, `Places SDK`, and `RxJava` to the `build.gradle` file, then rebuild the project. Developers can subscribe to events, like marker clicks, using extension functions. The library also supports merging multiple event types, such as various camera events, into a single observable stream using RxJava operators.\n"]]