How to enable particular feature in android app for specified users based on city using A/B Testing

1.6k views Asked by At

I want to enable particular feature based on user signed up city (Not based on user current geo location) in my android app.

I am able to get single city with key from Firebase Remote Config.But how do I map multiple cities with a single key so that I can a enable feature for those cities?

Will firebase remote config will help my requirement? If not, please suggest a tool which will meet my requirement.

Please find following snippet which I am trying using firebase-remote-config

//Here I am able to get single city only.
String enableCity = mFirebaseRemoteConfig.getString(ENABLE_CITY);

//lets take user city is Bangalore
if ("Bangalore".equalsIgnoreCase(enableCity)) {
       //enable feature
}

Here I want to get list of enabled cities which are updated from remote config to enable feature.

3

There are 3 answers

0
riggaroo On BEST ANSWER

Firebase Remote Config allows you to define user regions or countries on the server side, but not cities as far as I can tell.

In order to setup a parameter to be enabled for certain countries, you need to set it up on the server.

Head to the remote config section on the server and create a custom condition that targets the certain countries for that feature: create firebase remote config for region

Then once you have created the conditional for your countries, use it within a parameter like below: using region conditional for parameter

This will then allow you to enable the feature for certain region/countries.

Unfortunately the above won't work for cities. With regards to mapping certain cities, what you can do is set a custom user property to the users current city (perhaps if they choose it from a drop down or if you can get their city from location data?) and then create a conditional that is based on the users city as we did above. Using User properties to conditionally split audiences

0
user1139880 On

The Firebase Remote Config system is not aware of the user's city. However, if your app knows the user's city, you can set it as an analytics user property value and then use it in Firebase Remote Config conditions.

You can find more information here https://firebase.google.com/docs/remote-config/parameters (search page for 'user property'. The same technique can be used for other signals that are available to your app.

0
raghu On

One simple way is,

We can have all the cities in JSON string in the remote config for which the feature is enabled as below.

{ "enabled_cities": [ "Bangalore", "Delhi", "Kolkata" ] }

On the client side convert the JSON string to POJO and check whether the user city is in the array or not to enable the feature.