Google Maps Platform

A video guide to reactive programming with Google Maps Platform

Reactive programming blog header

The Google Maps Platform Android SDK supports extensions for reactive programming, which helps you write code to handle asynchronous operations.


Write reactive and responsive mapping applications with Google Maps Platform

In mobile apps, asynchronous events can happen at any point in time: user touch events, waiting for network calls to complete, or receiving push notifications, to name a few. As an app developer, accounting for these events and composing them with other asynchronous events can be challenging. Reactive programming is an alternative to passing callbacks for different events and helps simplify the process of working with asynchronous events. In reactive programming, events are modeled as a stream, emitting items over time.

There are two libraries you can use to write reactive code: Kotlin Flows and RxJava. The next two videos show you how to use each one.


Writing reactive and responsive mapping applications using Kotlin

If you’re a Kotlin developer looking to use Coroutines and Flows, the KTX library allows you to use Kotlin Flows to receive events. The Maps KTX library includes extension functions that return Kotlin Flow objects, so you can listen to events in a reactive manner. Unlike suspending functions, which return a single value, Kotlin Flows can return several values over time. For example, you can use a Flow to receive camera event changes over time. To get started using Kotlin Flows in your app, include the Maps KTX library in the dependencies section in your build.gradle file.

Creating reactive maps on Android with RxJava

Integrate Google Maps Platform SDKs with popular Android library RxJava. RxJava is the Java implementation of Reactive Extensions, which is a library for composing asynchronous and event-based programs using observable sequences. One thing RxJava does is allows you to convert callback-based asynchronous code into a chain of transformations. Learn how this works and the other ways you can use RxJava in the third video in this series.

​​We hope you learn more about reactive programming concepts to help you build responsive and reactive mobile apps in this three-part YouTube series. Have ideas for helpful videos you’d like to see on our channel? Leave a comment on any of our videos. And don’t forget to subscribe to our YouTube channel for the latest updates, tutorials, customer stories, and more.

For more information on Google Maps Platform, visit our website.