Ferra76
Ferra76

Reputation: 61

Using feature flag as kill switch in different version of mobile application

I'm interested to use feature flags as kill switch if something goes wrong in my mobile app release, to quickly get the features on the app to the last working version of the feature or to hide completely the feature.

But I have a logical doubt related to how can manage the same feature flag in the following version of the application after that I killed the feature in a previous version of the app. I try to explain with an example.

day 1 I develop a new feature A I implement feature toggle A on this new feature I deploy on play store myApp 1.0 with feature toggle A turned ON (server side)

day 2 I notice that something goes wrong on the feature A so I kill switch it turning OFF feature toggle A (server side) I fix "client side" the feature A I deploy on play store myApp 1.1 with the fixed version of the feature

But now I can't turn ON (server side) feature toggle A again because it would open the feature on bot version of the app

So I have to implement a new toggle every time that I use kill switch ? Any suggestion or link? Thanks

Upvotes: 1

Views: 886

Answers (2)

Mark C Allen
Mark C Allen

Reputation: 56

I agree with Nitrodist about API versioning, it's key to a good app/api strategy and will save you headaches in the long run.

From a pure Feature Flag perspective, you can use the version of the application as part of the logic to turn on or off the flag for the specific user.

Don’t think of feature flags as just on or off for all users, but as a way to turn a feature on or off for a specific user or set of users. For example, in DevCycle Mobile SDK you can set up the Feature Flag to be on for a specific version but off for the other.

let user = try DVCUser.builder()
.appBuild(1005)
.appVersion("1.1")
.build()

client.identifyUser(user)

Then you can use a boolean feature flag to show or hide the new component-based upon the version of the app they are using.

let newFeature: DVCVariable<Bool> = client.variable(key: "new-feature", defaultValue: false)

You can also control which API the user accesses based upon their appVersion.

let apiVersion: DVCVariable<String> = client.variable(key: "api-version", defaultValue: "1.0")

For this Feature Flag, the default value of the API is set to “1.0”. In the UI you can then set the Feature Flag to return “1.1” if the appVersion is set to 1.1.

Upvotes: 1

Nitrodist
Nitrodist

Reputation: 1755

You can use a lot of techniques to combat this.

Realize that when you release and use the App store and the Play store that you will have users who won't upgrade. The rest is left as an exercise to the developer - and I mean this quite seriously too because it's your app-level code that reacts to the running server, both of which you control, and that matters when you're talking about techniques like:

  • API versioning
  • Remote Feature Flag vendors like Firebase
  • Roll your own with your own iOS/Android code + server code
  • Open source tools for iOS/Android codebases involving feature flags

Upvotes: 0

Related Questions