Feature Flags in Android Apps
Turn features on and off without app updates
Today, we are going to discuss about the Feature Flags in Android Apps.
I’m Amit Shekhar from Outcome School, where I teach AI and Machine Learning, and Android.
Let’s get started.
Feature flags (also called feature toggles) are like light switches for your app’s features.
They let you turn features on or off without changing code or releasing a new app version.
For example, you build a new feature, but instead of showing it to everyone, you hide it behind a feature flag. You can then decide who sees it and when.
So, instead of writing code like this:
// Always show the new feature
showNewFeature()You write code like this:
// Show only if the flag is enabled
if (featureFlags.isNewFeatureEnabled()) {
showNewFeature()
}The flag value can come from:
A local config file
A backend server
A feature flag service like Firebase Remote Config.
Note: Always have the default values in case the network or feature flag service fails.
We can use this feature flags for:
Testing New Features Safely with Gradual Rollouts: You can release a feature to 5% of users first. If it works well, increase it to 10%, then 50%, then everyone.
If something breaks, you can turn it off immediately, no app store wait.
A/B Testing: Want to test a blue button vs a red button? Show one version to half the users and the other version to the rest, then measure the results.
Emergency Kill Switch: If a feature causes crashes or serious issues, you can turn it off instantly for all users while you work on a fix.
I teach these types of concepts at Outcome School and help you become a better software engineer.
Thanks
Amit Shekhar
Founder, Outcome School


