Setting up Feature Flags in a mobile application

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Setting up Feature Flags in a mobile application
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Setting up Feature Flags in mobile app

Feature flags — mechanism for enabling and disabling features without app update. Sounds minor, but changes entire development process: trunk-based development becomes possible, release train separates from feature readiness, and you have kill switch if new feature breaks production.

Most common use — postmortem protection: feature in production breaks payment flow for 5% of users, team can't ship hotfix in 2 hours due to App Store review. Flag disabled in 30 seconds.

Firebase Remote Config as basic tool

Remote Config — simplest way to implement flags without additional SDKs:

// iOS
let remoteConfig = RemoteConfig.remoteConfig()

// Default values — work offline and until first fetch
remoteConfig.setDefaults([
    "new_payment_flow_enabled": false as NSObject,
    "chat_feature_enabled": false as NSObject,
    "max_cart_items": 50 as NSObject
])

remoteConfig.fetch(withExpirationDuration: 300) { status, error in // 5 minutes
    remoteConfig.activate()
}

// Usage
var isNewPaymentEnabled: Bool {
    remoteConfig.configValue(forKey: "new_payment_flow_enabled").boolValue
}
// Android
val remoteConfig = Firebase.remoteConfig
remoteConfig.setDefaultsAsync(mapOf(
    "new_payment_flow_enabled" to false,
    "chat_feature_enabled" to false
))

remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
    val isNewPaymentEnabled = remoteConfig.getBoolean("new_payment_flow_enabled")
}

Main Firebase Remote Config downside — no flexible targeting. Flag on for everyone or for segment by conditions (country, app version, Firebase audience). Percentage rollout exists but through A/B Testing interface.

LaunchDarkly for complex targeting

When need rollout by specific user_id, companies or complex rules:

// iOS LaunchDarkly SDK
import LaunchDarkly

let user = LDUser(key: userId, email: userEmail)
LDClient.start(config: LDConfig(mobileKey: "mob-xxx"), user: user)

// Synchronous flag check
let isEnabled = LDClient.shared.boolVariation(forKey: "new_payment_flow", defaultValue: false)

// With context for logging
let (value, detail) = LDClient.shared.boolVariationDetail(forKey: "new_payment_flow", defaultValue: false)
print("Reason: \(detail.reason)") // RULE_MATCH, FALLTHROUGH, OFF...

LaunchDarkly supports targeting rules: enable flag for users with plan == "enterprise" or for first 10% of users sorted by user_id. For gradual rollout this is more accurate than random percentage.

Flag organization in code

All flags in one place — not scattered through business logic:

// FeatureFlags.swift
struct FeatureFlags {
    private let remoteConfig = RemoteConfig.remoteConfig()

    var isNewPaymentFlowEnabled: Bool {
        remoteConfig.configValue(forKey: "new_payment_flow_enabled").boolValue
    }

    var isChatEnabled: Bool {
        remoteConfig.configValue(forKey: "chat_feature_enabled").boolValue
    }

    var maxCartItems: Int {
        Int(remoteConfig.configValue(forKey: "max_cart_items").numberValue)
    }
}

// Usage
if AppDependencies.featureFlags.isNewPaymentFlowEnabled {
    showNewPaymentFlow()
} else {
    showLegacyPaymentFlow()
}

If flags centralized, finding all uses through grep or refactor — task of minutes, not hours.

Flag lifecycle: creation → deletion

Flags accumulate and become technical debt. Good practice — flag lives max 3 months:

  1. Flag created — feature hidden
  2. Rollout started — enable gradually
  3. 100% of users on new version → flag = true for everyone
  4. Delete flag and dead code of old behavior from codebase

If not deleting — in a year codebase will have 40 flags, half of which true for 100% of audience.

What's included in the work

  • Remote Config (Firebase) or LaunchDarkly / Statsig connection
  • Implementing centralized FeatureFlags layer
  • Setting up default values for offline work
  • Configuring targeting rules and rollout percentages
  • Setting up flag monitoring in dashboard
  • Documenting flag lifecycle for team

Timeline

Firebase Remote Config with basic flag set: 0.5–1 day. LaunchDarkly with targeting rules and percentage rollout: 1–2 days. Cost calculated individually.