Creating a Custom Feature Flagging Platform for Android with Firebase

The setup

The setup is pretty easy. We have an Android app with 2 features we want to control remotely: showInAppPurchase should only enable the UI for a dialog for an in-app purchase, while enableCoolBackendFeature will bring more advanced functionality to the app. We are not going into detail about this. The interface is straightforward with 2 boolean properties.

if (featureFlagging.showInAppPurchase) {
// TODO show in-app purchase dialog

Setup Firebase Remote Config

I’m not going into detail how to fully set up Firebase Remote Config, as there is already an awesome tutorial in their docs here. I just want to outline that setting up the remote config object only requires about 6 lines of code. The only important thing here is, that Remote Config requires a set of default values, so your flags have always a defined state.

Leveraging the capabilities of Firebase Remote Config

It´s only fair to say, that this implementation of a feature flagging platform using Firebase lacks a lot of functionality and is not meant to a replace dedicated feature flagging platforms. However, it still has some cool features. First, it has a very simple UI. Second, and more important: It allows you to define conditions. The flag cool_feature, for example, will only address phones, which are currently located in Germany. So in this example, the developer can decide to try a specific feature on the German market, before releasing it worldwide. Other conditions include device language, app version, OS type (Android/iOS) or users in randomly assigned percentile.

Firebase Remote Config


The very simplistic example shows how each developer can build its individual feature flagging platform with very low effort. Of course, this lacks some essential features, which are available on bigger platforms. This implementation does not support A/B testing (although implicitly it supports it, as firebase provides a separate feature for A/B testing based on Remote Config), a real precise roll-out strategy and a limited set of conditions.



CTO & Co-Founder of VIABIRDS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store