androidfirebase-remote-configfirebase-ab-testing

Parameters isn't correctly set in Firebase A/B Testing using Remote Config


My A/B Testing has a parameter "POSITION".

"TOP" is set to the parameter "POSITION" in 50% of users as control group

and "BOTTOM" is so in 50% of users as variant.

Then, I tried to get the value of the parameter in the following code.

    mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();

    FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG).build();

    mFirebaseRemoteConfig.setConfigSettings(configSettings);

    ....................

     mFirebaseRemoteConfig.fetch().addOnCompleteListener(this, new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if(task.isSuccessful()){
                mFirebaseRemoteConfig.activateFetched();




                String abtest = mFirebaseRemoteConfig.getString("POSITION");


                switch (abtest){
                    case "TOP":
                        ........
                        break;

                    case "BOTTOM":
                        ........

                    case "":
                        Log.v("abtest",empty);

                }

            }
        }
    });


    ......................

Above code is contained in class MainActivity and mFirebaseRemoteConfig is

its field.

But mFirebaseRemoteConfig.getString("POSITION") sometimes returns "".

Why does this happen?


Solution

  • Percent of target users should be set to 100% for all users to receive an experiment.