Is there a way to get all the configs in String data type? There is a public method getAll()
which is a Map<String, FirebaseRemoteConfigValue>
but the value is an interface.
@NonNull
public Map<String, FirebaseRemoteConfigValue> getAll() {
return getHandler.getAll();
}
It is guaranteed in our setup that the config values are in String data type.
2
Answers
So far this is what I ended up, considering that all configuration value for this app is data type of String.
FirebaseRemoteConfig stores your data as json in your application’s files directory. And these values don’t have a data type at the moment. You may convert any
FirebaseRemoteConfigValue
to string but notBoolean
orLong
.We can see that
FirebaseRemoteConfigValue
interface always return a string from a value but may throw anIllegalArgumentException
for other primitive data types.There may be a tricky solution. If you can add a prefix to your remote config values, you may get them by a specified prefix. This trick requires the developer to set a prefix to all string values. (May not suit to everyone)
Hope it helps.