Getting all possible values for a key in Firebase's Remote Config

2.4k views Asked by At

I'm trying to build a settings screen in developer mode in which we can test toggling the different values for a remote config setting using Firebase. I have been able to get all the keys from Firebase's remoteConfig but can only manage to get the value applied for the current client. Anyone knows if it's possible to check for all possible values from Firebase?

1

There are 1 answers

0
protonss On

Manage your configs with something like this:

public class RemoteConfig {

    public final static String CONFIG_X = "CONFIG_X";
    public final static String CONFIG_Y = "CONFIG_Y";

    private final static List<String> keys = new ArrayList<String>(0);

    static {
        values.add(CONFIG_X);
        values.add(CONFIG_Y);
    }

    public static List<String> getKeys(){
        return values;
    }

}

And Getting All with this;

FirebaseRemoteConfig mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();

List<String> remoteConfigs = new ArrayList<>();

for (String key : RemoteConfig.getKeys()) {
    String keyValue = String.format("%s: %s", key, mFirebaseRemoteConfig.getString(key));
    remoteConfigs.add(keyValue);
}