blog post banner image

How Can Mobile Teams Best Use Feature Flags?

Ann McArthur

7/16/2023

How To Use Feature Flags in Mobile Development

A mobile engineer's worst fear is rolling out a new version of their app with one minor mistake that has led to the app crashing. With the bug live to millions of users fixing the bug immediately is nearly impossible. It can take days or months to have a release approved by the app store and even once the bug fix is complete users will have to update the app in the app store. So how can a developer resolve this issue?

This is where feature flags come to the rescue. Feature flags are a simple mechanism to allow mobile teams to make changes without affecting the entire product. If you’ve ever wondered why you didn’t get the new app update your friend told you about or how that buggy feature you saw yesterday went away without an update, it is probably because of feature flags.

What are Feature Flags?

A feature flag is a configuration variable that is used to either enable or disable a feature. This conditional statement determines whether the code enabling the feature will be turned on or off.

Mobile developers can use feature flagging to test code in production while also being able to kill the code with a single click if there is a problem. It's a great way for teams to safely work on a product and separate the deployment of new features from releases. When things don't go as planned in production, it's important to manage the chaos with feature flags. This lets you disable features when they malfunction, so your engineering team can find out what went wrong.

For features that will take a long time to complete, instead of creating a long-living feature branch then struggling with merge hell later on, you can use feature flags to push and deploy your code changes to production without affecting any existing functionality. The feature can then be activated whenever it is ready.

How Do Beta Flags Support Development?

In the past, companies have tested new features by putting them on a production server that's open to the general public. This is less risky than beta testing but still not as safe as testing with a subset of real, live end-users. Feature flags offer a way to make gradual changes to a software system and release it to a subset of users for feedback. The full release happens only after the company gets the feedback from beta testers.

When You Should Use Them

You should always use feature flags when making an update or releasing a new feature. Feature flags allow for CI/CD and are very helpful for deployment. They help reduce the risk of deployment, letting teams disable features if they encounter serious bugs or crashes and they can be used to control the complete life cycle of new features. 

Feature flags can be used for a variety of purposes, such as testing in production and collecting feedback from a controlled rollout. They allow teams to expose experiments to a select group of customers or validate app updates in the real world with minimal risk.

The Difference for Mobile Apps

There are several use cases for feature flags with mobile apps that you can implement. Some use cases include marketing campaigns, A/B testing, subscription management, or providing early access for new features. 

Mobile development teams can use feature flags to separate the code deployment from the release of features. A common example of this strategy is releasing a feature to a group of exclusive users that can drive signups. This way, product and marketing teams can safely roll out features when they are ready, rather than releasing them to the public and then immediately roll them back if something goes wrong.

Feature flags can be a powerful tool for mobile apps. Feature flags can be used to test different experiences for a subset of users. For instance, you can divide your user base into two sections. The first group will receive a different feature than the second group. After a trial period has passed, you can then compare the results to determine which user experience is best for your business based on user engagement, revenue, or any other KPI you’re looking to optimize.

Feature flags can be used to adjust and control which features individual customers see. This level of customization makes your website more appealing and relevant for each customer and improves their experience, which will ultimately result in increased returns and revenue. Alternatively, if you want to gate certain features or content for subscribers you can use feature flags to have certain areas of your app only available for subscribers.

Mobile developers also use early access to new features as a common way to get feedback and help people feel like they're a part of an exclusive group. For example, Google Labs gives users early access to new features in return for exclusive benefits.

Testing and Implementation 

There are multiple paths to success with implementing feature flags. If you want to know what path is best for your team, it depends on your needs and organizational goals. You can store feature flags configuration files like the iOS .plist file or .env file, then access them in if/else statements in your code. This is one of the simplest methods for storing flag values that teams often use when they are just starting out but this method can be hard to manage as your feature flagging grows.

Another option is to use database configs. You store your flag settings in a database, which is a convenient place as you can modify them with an administration interface. Another option is to use open-source libraries however installing and maintaining open-source libraries for feature flags management is tricky.

If you want to get the most out of feature flags, the best option is to use a third-party feature management tool like DevCycle. Using a feature management tool saves your engineering team time and resources and lets them focus on what they do best by focusing on your mobile app. Using a third-party tool also makes it easier to manage your feature flags and ensure you’re following best practices. 

Best Practices for Feature Flagging

In order to have an organized workflow for your feature flags, it’s important to adhere to best practices.

1️⃣  Have a naming convention

One of the most important things you can do in order to maintain organization is to make sure your team members are naming flags with the same naming conventions. If they don't, they may end up activating the wrong flag, leading to system interruptions. One way to solve this issue is to create a convention for naming flags. That way, when team members see the word "Flagname," they're able to quickly identify which flag it is, no matter what it's named. 

Your feature flag naming convention should be as descriptive as possible and include things like the date, flag type, and what it does. For example, if you’re flag is related to a beta test you can name it BetaTest_04-02-21_beta.

2️⃣  Assign each flag to an owner

Every flag should have an owner at all times. That person should be able to tell you why the flag was added, and they should be responsible for removing the flag. If the person can't do that, then that feature will become stale and unmaintained, which will lead to technical debt.

3️⃣  Remove old feature flags

You should also make sure to remove old feature flags. Deleting feature flags is just as important as creating them. Unless the flag is a permanent part of the system, it needs to be removed when the feature is no longer in use or changed. You should also make note of feature flag dependencies. One way to avoid conflicting feature flags is to map out the dependencies before they are released. This will allow teams to identify features that may conflict with one another.

Learn More with DevCycle

Feature flags are useful for releasing new features while avoiding lengthy approval processes. They also help when bugs occur since you can selectively turn the feature off until the bug is resolved. This allows mobile developers to have more control over their releases.

 Start using feature flags for mobile development and see why DevCycle is the developers' choice for feature flags.


Written By

Ann McArthur