Our SDK system already handles getting data from Firebase Remote Config, so if your app gets data from Firebase Remote Config, remove it and use functions from the SDK side.

Callback when Firebase Remote Config receives data successfully

Add callback

  fun setOnRemoteConfigDataListener(callback: IKNewRemoteConfigCallback?)
  
Example

Remove callback

Remove all callbacks related to listening for remote configuration data updates.

  fun removeOnRemoteConfigDataListener()
  

Fetch data from Firebase Remote Config

Get from cache

The SDK fetches and stores Firebase Remote Config data in a HashMap through the IKSdkController getRemoteConfigData() method. This allows developers to access configuration values efficiently by keys, facilitating dynamic control over app settings or features.

  suspend fun getRemoteConfigData(): java.util.HashMap<String, IKRemoteConfigValue>
  
Example
  class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)

        lifecycleScope.launch {
            val keyTest: String? = IKSdkController.getRemoteConfigData()["key_test"]?.getString()
        }
    }
}
  

Get from remote

In the SDK, Firebase Remote Config data is generally managed and cached by the SDK itself. However, if you prefer not to rely on the cached data and need to fetch the latest configuration directly from Firebase, you can use the IKSdkController fetchNewRemoteConfigData() method.

  fun fetchNewRemoteConfigData(callback: IKNewRemoteConfigCallback)