【问题标题】:Is it possible to fetch specific Firebase Remote Config settings in reaction to user behavior?是否可以根据用户行为获取特定的 Firebase 远程配置设置?
【发布时间】:2018-09-16 06:37:22
【问题描述】:

是否可以根据用户输入或行为获取一组特定的 Firebase 远程配置参数?假设我们要求用户输入他们喜欢的颜色,然后我们想为输入该颜色的用户提供量身定制的 Remote Config,有没有办法做到这一点?

我希望做类似的事情:

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"
    }
}

【问题讨论】:

    标签: android kotlin firebase-remote-config


    【解决方案1】:

    在同事的帮助下,我们得以解决这个问题!

    firebaseAnalytics.setUserProperty(USER_FAVORITE_COLOR, favoriteColor)
    firebaseRemoteConfig.fetch(0).addOnCompleteListener(remoteConfigFetchListener)
    

    它甚至会立即发生!当 remoteConfigFetchListener 被调用远程配置值时,我们可以activateFetched() 使用我们在 Firebase 远程配置 Web 控制台中配置的值。 :D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-03
      • 2021-02-27
      • 2020-06-13
      相关资源
      最近更新 更多