HMS Remote Config | Solar2D

Kayahan Başkeser
Huawei Developers
Published in
2 min readFeb 14, 2021

--

Hi everyone,

In this article, I will mention how to use HMS Remote Config on Solar2D.

First of all, we should create a Solar2D project and import plugin to “build.settings” file. If you do not have enough information about HMS Solar2D plugin integration, I recommend you to read this article. HMS Solar2D Plugin Integration

You can access all information about HMS Remote Config here.

Let’s start after completing the HMS integration.

First we need to import plugin to build.settings file.

And we need to specify minSdkVersion in “build.settings” file for HMS Remote Config.

Note : Don`t forget to place agconnect-services.json file in main.lua directory.

After all the configuration processes, we must define the plugin in main.lua.

We should call all methods through remoteConfig object. And you can take result informations from listener function.

Methods in the Plugin

applyDefault

Used to add a default values.

fetch

Used to pull the values from cloud. If you don`t know to add parameter in cloud, check here

getValueAsBoolean

Returns the value of the boolean type for a key.

getValueAsDouble

Returns the value of the double type for a key.

getValueAsLong

Returns the value of the long type for a key.

getValueAsString

Returns the value of the string type for a key.

getMergedAll

Used to get all values obtained in Remote Config.

getSource

Used to find the source of a value.(STATIC, DEFAULT, REMOTE)

clearAll

Used to clear all cached data which fetched from Remote Configuration and default values.

setDeveloperMode

Used to receive data unlimited times from the cloud, you can set Developer Mode.

And you can examine the sample project from the following repository.

References

--

--