Issue
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.
Solution
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:
Then once you have created the conditional for your countries, use it within a parameter like below:
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.
Answered By - riggaroo
Answer Checked By - Willingham (JavaFixing Volunteer)