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

RxJava is a reactive programming library for composing asynchronous and
event-based programs by using observable sequences.

The [Maps Rx library](https://github.com/googlemaps/android-maps-rx)
lets you receive observable sequences for asynchronous events on the
Maps SDK for Android and Places SDK for Android so you can
take advantage of the rich set of RxJava features.

## Installation

> [!NOTE]
> **Note:** See the [Maps Rx library](https://github.com/googlemaps/android-maps-rx) documentation on GitHub for system requirements and installation instructions.

To install the Maps Rx library in your Google Maps project:

1. Add the following dependencies to your module-level `build.gradle` file:

   <br />

   ```yaml
       dependencies {
       // RxJava bindings for the Maps SDK
       implementation(libs.maps.rx)

       // RxJava bindings for the Places SDK
       implementation(libs.places.rx)

       // 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:20.0.0")
       implementation("com.google.android.libraries.places:places:5.3.0")
       implementation("io.reactivex.rxjava3:rxjava:3.1.12")
   ```

   <br />

2. Rebuild your project in Android Studio to sync these changes.

## Example usage

Receive an `Observable` for marker click events as an extension function on the
`GoogleMap` object:

<br />

```yaml
googleMap.markerClickEvents()
    .subscribe { marker ->
        Log.d("MapsRx", "Marker ${marker.title} was clicked")
    }
```

<br />

Use the `merge` RxJava operator to combine various camera events into a single
`Observable` stream:

<br />

```yaml
Observable.merge(
    googleMap.cameraIdleEvents(),
    googleMap.cameraMoveEvents(),
    googleMap.cameraMoveCanceledEvents(),
    googleMap.cameraMoveStartedEvents(),
).subscribe {
    // Notified when any camera event occurs
}
```

<br />

## What's next

- See the [Maps Rx library](https://github.com/googlemaps/android-maps-rx) GitHub project page.
- See the [Maps Rx library API reference](https://googlemaps.github.io/android-maps-rx/).