Firebase Remote Config: Can't read any values, but fetch is successful

前端 未结 10 936
长发绾君心
长发绾君心 2020-12-30 19:10

I\'m trying to have a remote config parameter using the new Remote Config feature of Firebase, and I\'m having an issue.

Here\'s my Remote Config console:

I

10条回答
  •  醉话见心
    2020-12-30 19:34

    I had a problem that Firebase Remote Config didn't fire OnCompleteListener with fetch(0), but with fetch() did.

    Looking at FirebaseRemoteConfig.fetch() does not trigger OnCompleteListener every time, I found that the first answer was working sometimes even with fetch(0). Then I again set 3600 seconds for interval, as errors continued to appear:

    override fun onPostResume() {
        super.onPostResume()
    
        // Initialize FirebaseRemoteConfig here.
        ...
    
        firebaseRemoteConfig.fetch(3600).addOnCompleteListener { task ->
            if (task.isSuccessful) {
                firebaseRemoteConfig.activateFetched()
                //calling function to check if new version is available or not
                checkForUpdate(currentVersionCode, firebaseRemoteConfig.getString(VERSION_CODE_KEY))
            } else
                Toast.makeText(this@MainActivity, "Someting went wrong please try again",
                    Toast.LENGTH_SHORT).show()
        }
    
    }
    

提交回复
热议问题