RxJava Library

  • The Places Rx library enables the use of RxJava features for asynchronous events in the Maps SDK and Places SDK for Android.

  • It provides observable sequences for events like fetching place details, allowing developers to handle them reactively.

  • You need to add specific dependencies to yourbuild.gradle file to integrate the Places Rx library into your project.

  • Refer to the official GitHub project page and API reference for further details and usage examples.

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

ThePlaces Rx librarylets you receive observable sequences for asynchronus events on the Maps SDK for Androidand Places SDK for Android so you can take advantage of the rich set of RxJava features.

Installation

Note:See thePlaces Rx librarydocumentation on GitHub for the latest system requirements and installation instructions.

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

  1. Add the following dependencies to your module-levelbuild.gradle file:

    dependencies {// RxJava bindings for the Maps SDKimplementation(libs.maps.rx)// RxJava bindings for the Places SDKimplementation(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:19.2.0")implementation("com.google.android.libraries.places:places:4.4.1")implementation("io.reactivex.rxjava3:rxjava:3.1.12")
  2. Rebuild your project in Android Studio to sync these changes.

Example Usage

The following example shows how you can receive aSingle,and subscribe to it, when fetching place details:

placesClient.fetchPlace(placeId = "thePlaceId",placeFields = listOf(Place.Field.ID, Place.Field.NAME, Place.Field.ADDRESS),actions = {}).subscribe({ response ->Log.d("PlacesRx", "Successfully got place ${response.place.id}")},{ error ->Log.e("PlacesRx", "Could not get place:${error.message}")})}

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-21 UTC.