Is it possible to fetch a specific set of Firebase Remote Config parameters based on user input or behavior? Suppose we ask a user to input their favorite color and then we want to provide a Remote Config tailored to users who put in that color, is there any way to do that?
I was hoping to do something like:
val settings = FirebaseRemoteConfigSettings.Builder()
.setString(USER_FAVORITE_COLOR, editTextFavoriteColor.text)
.build()
firebaseRemoteConfig.setConfigSettings(settings)
firebaseRemoteConfig.fetch()
.addOnCompleteListener {
if (it.isSuccessful) {
firebaseRemoteConfig.activateFetched()
textViewGreeting.text = "Hello, fellow
${firebaseRemoteConfig.getString(BACKGROUND_COLOR)} lover"
}
}
With a coworker's help we were able to figure this out!
firebaseAnalytics.setUserProperty(USER_FAVORITE_COLOR, favoriteColor)
firebaseRemoteConfig.fetch(0).addOnCompleteListener(remoteConfigFetchListener)
It even happens immediately! By the time remoteConfigFetchListener gets called the Remote Config values we can activateFetched()
with are the ones that we configured in the Firebase Remote Config web console. :D