Note: I have opened an issue at the official Firebase Github repo here: https://github.com/firebase/firebase-android-sdk/issues/4864
I have an existing set of Remote Configs that I've updated via Firebase Console, but even after enabling the realtime API in Google Cloud and setting it up a listener for config changes on my Android app, my app did not receive any updates. Inspecting the graphs at Google Cloud, it seems that for the past hour, only errors (with status code 503) have been recorded, please see graphs:
In my Application class, I initialize a class that wraps around FirebaseRemoteConfig:
remoteConfigManager = new FirebaseRemoteConfigManager(FirebaseRemoteConfig.getInstance());
remoteConfigManager.initializeConfig();
remoteConfigManager.fetchLiveUpdates();
Within the FirebaseRemoteConfigManager class, fetchLiveUpdates calls addOnConfigUpdateListener and listens for updates:
class FirebaseRemoteConfigManager(private val firebaseRemoteConfig: FirebaseRemoteConfig): RemoteConfigManager {
override fun initializeConfig() {
Log.w(TAG, "Initialize remote config")
with(firebaseRemoteConfig) {
setConfigSettingsAsync(
remoteConfigSettings {
minimumFetchIntervalInSeconds = 0L
}
)
setDefaultsAsync(R.xml.remote_config_defaults)
}
}
override fun fetchLiveUpdates() {
Log.w(TAG, "Start live updates")
firebaseRemoteConfig.addOnConfigUpdateListener(object : ConfigUpdateListener {
override fun onUpdate(configUpdate: ConfigUpdate) {
Log.w(TAG, "Updated keys: " + configUpdate.updatedKeys)
firebaseRemoteConfig.activate()
}
override fun onError(error: FirebaseRemoteConfigException) {
Log.w(TAG, "Config update error with code: ${error.code}")
}
})
}
}
onUpdate
and even onError
were not triggered even if I published my Remote Configs. Has anyone encountered the same behavior?
I got in touch with Firebase Support and it was an issue on their end that got resolved. I also noticed that using both Java and Kotlin versions of the Firebase Remote Config and Analytics libraries caused some weird behavior, so I just removed the Java library and I got realtime updates working.