Remote Configurations
Setup Remote Configurations
GameAnalytics' Remote Configurations
feature offers the ability to set up and tune values in your game's dashboard.
These values can be changed on the whim without needing to release a new version of the game.
The remote configs are a custom set of key-pair values.
Set up your Remote Configurations in the GameAnalytics dashboard.
Check Remote Config Updates in C++
GameAnalytics offers the option to setup remote configs in your dashboard that can be changed on the whim without needing to release a new version of the game.
The remote configs are a custom set of key-pair values.
class MyOnRemoteConfigsListener : public IRemoteConfigsListener
{
public:
MyOnRemoteConfigsListener() {}
void onRemoteConfigsUpdated(std::string const& remoteConfigs) override {
// Add your logic here
std::cout << "Remote Configs updated!" << std::endl;
std::cout << remoteConfigs << std::endl;
}
};
// in your function
auto myOnRemoteConfigsListener = std::make_shared<MyOnRemoteConfigsListener>();
gameanalytics::GameAnalytics::addRemoteConfigsListener(myOnRemoteConfigsListener);
Manual Check for Remote Config Updates
To manually check if Remote Configs are ready (if they have been populated with values from the server) you can use the following method:
if(gameanalytics::GameAnalytics::isRemoteConfigsReady())
{
// the remote configs is ready, add your code here
}
The isRemoteConfigsReady
function will return false if the configs haven't been populated by the server yet.
Retrieve Remote Config Values
After the remote configs have been populated you can retrieve their values by using the following function:
// Without custom default value (using normal default value)
std::string value = gameanalytics::GameAnalytics::getRemoteConfigsValueAsString("key");
// With custom default value
std::string valueWithCustomDefaultValue = gameanalytics::GameAnalytics::getRemoteConfigsValueAsString("key", "myDefaultValue");
If the specified key is not found in the Remote Configs it will return the default value of either “normal”
or “custom”
value.
For more information on Remote Configs go here.