3

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.

riggaroo
  • 2,070
  • 16
  • 32
raghu
  • 444
  • 3
  • 10

2 Answers2

1

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

riggaroo
  • 2,070
  • 16
  • 32
0

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.

user1139880
  • 1,778
  • 2
  • 17
  • 27