We recently released version 4.3.0 of the Android library, making it easier for you to implement middlewares. Support for middlewares has been a part of our Android SDK in beta and used by hundreds of customers since May, and we are excited to promote the beta to a stable release.

What are client-side middlewares?

Middlewares are custom functions that you can write to modify the client-side event stream. These simple functions can now be invoked by the Segment SDK and used to monitor, modify, or reject events, before being sent to your Destinations.

Middlewares are invoked for all events, including automatically tracked events and external event sources like Adjust and Optimizely. This offers you the ability to customize these messages to fit your use case even if the event was sent outside your source code.

For example, you might want to record the property, device year class, with your events. Previously, you would have had to manually track this everywhere you trigger an event with the Segment SDK. With middlewares, you only have to write a single function, regardless of how many unique events you track. 

We also released some smaller features and bug fixes as part of this release. See our Github changelog for more details. If you’re using an older version of the Android library, head on over to the docs for instructions on upgrading to version 4.3.0.