Get Server configurations

⚙️ REL-ID SDK: getConfig API and onConfigReceived Event


📌 Overview

This document covers the complete configuration flow using the REL-ID SDK:

  • getConfig – API to request server-driven configurations.
  • onConfigReceived – Event triggered with configuration data once the request succeeds.

These components enable dynamic behavior such as personalized UI elements, control panel configurations, or URL-based navigation.


🔁 Workflow

App calls getConfig()
      ↓
Server sends configuration data
      ↓
SDK triggers onConfigReceived
      ↓
App parses and applies configuration

📤 getConfig API

🔍 Purpose

To request full configuration from the server for the current user/device context.

🧾 Request Parameters

FieldTypeDescription
chlngStringUse "all" to fetch all configs.

Sample Payload

{
  "chlng": "all"
}

🧠 Platform Code Snippets for getConfig

React Native
RdnaClient.getConfig(
  JSON.stringify({ chlng: "all" }),
  (syncResponse) => {
    console.log("Config requested", syncResponse);
  }
);
Flutter
rdnaClient.
  getConfig('{ "chlng": "all" }');
Cordova
com.uniken.rdnaplugin.RdnaClient.getConfig(
  function(success) {
    console.log("Config success:", success);
  },
  function(error) {
    console.error("Config error:", error);
  },
  '{ "chlng": "all" }'
);
Native iOS
let error = RdnaClient.getConfig("{"chlng":"all"}")
Native Android
RDNAError error = rdna.getConfig("{"chlng":"all"}");

📥 onConfigReceived Event

🔍 Purpose

Triggered automatically after a successful getConfig call. Sends dynamic config data that apps can parse and apply.


Sample payload

{
  "errCode": 0,
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  },
  "eMethId": 5,
  "pArgs": {
    "response": {
      "ResponseData": {
        "config": [
          {
            "key": "main_page_url",
            "value": "http://__CONNECTEDIP__:8080/cp/index.jsp?userId=__USERNAME__"
          },
          {
            "key": "control_panel_v1",
            "value": {
              "mode": "BUTTON_PANEL",
              "data": []
            }
          }
        ]
      }
    }
  }
}

🧠 Platform Code Snippets for onConfigReceived

React Native
rdnaEventRegistery.addListener('onConfigReceived', (eventData) => {
  const configList = JSON.parse(eventData).pArgs.response.ResponseData.config;
  console.log("Config received", configList);
});
Flutter
rdnaClient.on(RdnaClient.onConfigReceived, (event) {
  print("Configuration received: ${event.pArgs.response.ResponseData.config}");
});
Cordova
document.addEventListener('onConfigReceived', function(event) {
  const data = JSON.parse(event.detail);
  console.log("Config Received: ", data.pArgs.response.ResponseData.config);
});
Native iOS
func onConfigReceived(_ status: RDNAStatusGetConfig) {
    print("Received config: \(status.responseData ?? "")")
}
Native Android
public void onConfigReceived(RDNAStatusGetConfig status) {
    String configData = status.getResponseData();
    Log.d("REL-ID", "Received Config: " + configData);
}

🧷 Notes

  • Always call getConfig() after SDK initialization or login.
  • Parse keys like main_page_url or control_panel_v1 for UI customization.
  • Handle and apply configurations inside the onConfigReceived callback.