[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-12。"],[],[],null,["\u003cbr /\u003e\n\niOS+ Android Flutter Unity C++ \n\n\u003cbr /\u003e\n\nReal-time Remote Config lets you receive updated\n[parameter keys and values](https://firebase.google.com/docs/remote-config/parameters)\nas soon as they're published on the server. This allows you to quickly update\nany type of app attribute controlled using a Remote Config parameter value.\nWith real-time Remote Config updates, you can:\n\n- Reduce risk by rolling out features incrementally to targeted users, and performing an emergency rollback if needed.\n- Increase user engagement by quickly customizing user experiences as they use the app. For example, you could update banners and offer incentives for users who match specific Google Analytics user properties or dynamically adjust game difficulty for cohorts of players.\n- Reduce build dependencies and increase developer productivity: Use Remote Config parameters as feature flags to expose functionality for your development and test teams, while keeping it hidden to users in production.\n\nTo learn more about ways you can use Remote Config, see\n[What can you do with Remote Config?](https://firebase.google.com/docs/remote-config/use-cases)\n\nIn this guide, you'll:\n\n- Learn more about the client-server relationship that supports real-time updates.\n- Understand how the real-time functionality in the SDK works.\n- Learn how to use real-time updates to keep your app configuration up-to-date.\n\n|\n| Real-time updates are available for the following versions of the\n| Remote Config SDK:\n|\n| - iOS: v10.7.0+\n| - Android: v21.3.0+ (Firebase BoM v31.3.0+)\n| - C++: v11.0.0+\n| - Unity: v11.0.0+ (Android and Apple platforms)\n| - Flutter: v4.0.0+ (Android and Apple platforms)\n\nThe real-time client-server connection\n\nWhen you implement real-time Remote Config in your app, you create a\nreal-time listener that opens an HTTP connection to the Remote Config\nbackend. The request includes the config version that's currently cached on the\ndevice. The real-time Remote Config server uses an *invalidation message* to\nsignal to the app when a newer version of a server-side config should be\nfetched.\n\nIf the server has a newer version, it sends the invalidation signal immediately.\nIf it doesn't have a newer version, it keeps the connection open and waits until\none is published on the server. When the client SDK receives an invalidation\nsignal, it automatically fetches it, then calls the listener callback registered\nwhen you opened the listener connection. This fetch is similar to the fetch\ncall you can make with the SDK, but bypasses any caching or\n`minimumFetchInterval` setting. The client-server connection is maintained while\nthe app is in the foreground.\nReal-time Remote Config client-server workflow\n\nSince the client-server connection is made over HTTP, it doesn't require any\ndependencies on other libraries.\n\nListen for updates\n\nReal-time updates complement Remote Config `fetch` calls. We recommend\ncalling fetch when your app starts (or sometime during your app's lifecycle)\nand listening for real-time Remote Config updates during the user session to\nensure that you have the latest values as soon as they're published on the\nserver.\n\nTo listen for updates, call\n\n[`addOnConfigUpdateListener`](/docs/reference/swift/firebaseremoteconfig/api/reference/Classes/ConfigUpdateListenerRegistration),\n\nimplementing a callback that is invoked whenever a Remote Config update is\navailable in the app. Behind the scenes, this call starts listening for updates\nfrom the Remote Config server. To learn more about the client-server\nrelationship, see\n[the previous section](#real-time-client-server-connection).\n\nThe callback is often a good place to use `activate` to make the updated config\nparameters available to your app. See\n[Firebase Remote Config Loading Strategies](https://firebase.google.com/docs/remote-config/loading)\nfor additional strategies to activate parameter values when you're using\nreal-time Remote Config.\n\nSelectively activate parameter values\n\nWhen you call\n\n[`addOnConfigUpdateListener`](/docs/reference/swift/firebaseremoteconfig/api/reference/Classes/ConfigUpdateListenerRegistration),\n\nyou can await the change and activate it.\nThe `onUpdate` callback is called when both a new version of the template has been automatically fetched and when that new version has changes to the currently activated parameter values in the app.\n\n\u003cbr /\u003e\n\nThese callbacks are invoked with a parameter `configUpdate`. `configUpdate`\ncontains\n\n\n`updatedKeys`,\n\nwhich is the set of changed parameter keys that initiated the real-time\nupdate and includes the following:\n\n- Parameter keys added or removed\n- Parameter keys whose values have changed\n- Parameter keys whose metadata has changed (for example, Remote Config personalization information)\n- Parameter keys whose value source has changed (for example, an in-app default value updating to a server-side value)\n\nIf you're using a real-time listener in a particular view within your app, you\ncan check if the parameters relevant to that view have changed before\nactivating.\n\nOccasionally, a fetch (either initiated when you call the `fetch` method, or by\nreal-time Remote Config) does not result in an update for the client. In\nthese cases, the\n\n`onUpdate`\n\nmethod or completion won't be called.\n\nAdd and remove listeners [`addOnConfigUpdateListener`](/docs/reference/swift/firebaseremoteconfig/api/reference/Classes/ConfigUpdateListenerRegistration) is the main entrypoint for real-time Remote Config. Calling this listener for the first time in your app's lifecycle opens the connection to the backend. Subsequent calls reuse the same connection, multiplexing the invalidation message described in [the real-time client-server connection](#real-time-client-server-connection).\n\n\u003cbr /\u003e\n\nThe call returns a \"listener registration,\" which has a method called [`remove`](/docs/reference/swift/firebaseremoteconfig/api/reference/Classes/ConfigUpdateListenerRegistration).\n\nTo stop listening, store the reference to the listener registration. Call\n`remove` to stop listening at this registration. If it's the only registered\nlistener, calling `remove` closes the real-time connection to the server.\nAlthough you *can* manually stop listening for updates, it's often not necessary. Real-time Remote Config automatically stops listening for updates when the app enters the background and restarts when the app is foregrounded.\n\n\u003cbr /\u003e\n\nNext steps\n\nCheck out [Get started with Firebase Remote Config](/docs/remote-config/get-started) to configure Remote Config and start [listening for updates in real-time](/docs/remote-config/get-started#add-real-time-listener)."]]