I am a novice to Android and Firebase. Is it possible to declare an array inside the the Parameter key of Firebase Remote Config?
I want to provide some promotions to some specific models/mobile devices. So if I could declare an array of models(i,e, Samsung J5, Xiaomi Note2 etc) I could easily enable promotions on those models. Please help me.
The Remote Config has recently added the option to save a key-value list by saving it to a JSON format.
Sample usage:
1.Json stored in Remote Configs:
[
{
"lesson": "1",
"versionCode": 2
},
{
"lesson": "2",
"versionCode": 4
},
{
"lesson": "3",
"versionCode": 1
}
]
2.Kotlin model
data class Lesson(val lesson: Int, val versionCode: Int)
3.Retrieve json
String object = FirebaseRemoteConfig.getInstance().getString("test_json");
Gson gson = new GsonBuilder().create();
List<Lesson> lessons = gson.fromJson(object, new TypeToken<List<Lesson>>(){}.getType());