Remote Config

circle-info

This feature is supported in React Native SDK version 3.3.0 and above.

Remote Config is a feature that allows you to replace values or properties managed in your application with parameter values defined in the Hackle Dashboard, enabling real-time control of your application's behavior and configuration.

Navigate to the Remote Config screen on the Hackle Dashboard to configure parameter information and set values based on user identification rules.

useRemoteConfig() or useLoadableRemoteConfig()

Using the useRemoteConfig() or useLoadableRemoteConfig() Hooks API returns a HackleRemoteConfig instance containing the Remote Config information (configured parameters and rule information) for the user. You can access the desired parameter and retrieve its value through the methods provided by HackleRemoteConfig.

// 원격 구성 정보를 담은 인스턴스를 반환합니다.
const remoteConfig = useRemoteConfig()

// 원격 구성 정보를 담은 인스턴스를 반환합니다. - Lodable 사용 시
const {loaded, result} = useLoadableRemoteConfig()

Querying Remote Config Parameters

  • The HackleRemoteConfig returned by the useRemoteConfig() or useLoadableRemoteConfig() Hooks API provides a getSync() method for querying parameter values.

  • Since parameter values configured in Hackle's Remote Config screen exist in key-value format, you can use the following method based on the configured parameter type to retrieve the configured parameter value.

circle-exclamation
// 원격 구성 정보를 담은 인스턴스를 반환합니다.
const remoteConfig = useRemoteConfig()

//remoteConfig 에서 get() 메소드를 통해 parameter 값 가져오기
const parameterValue = remoteConfig.getSync(parameterKey, defaultValue)

// string 유형의 parameter값 예제
const strValue = remoteConfig.getSync("parmeterKey", "defaultValue")


// 원격 구성 정보를 담은 인스턴스를 반환합니다. - Lodable 사용 시
const { loaded, result } = useLoadableRemoteConfig()

if(loaded) {
  const parameterValue = result.getSync(parameterKey, defaultValue)
  const parameterValuePromise = result.get(parameterKey, defaultValue)
}
  • The parameterKey in the getSync() method is the key configured in the Remote Config parameter settings.

  • defaultValue is the value returned when the Remote Config value cannot be determined. The defaultValue you entered may be returned in the following situations: A. A value of a different type than the type configured on the Remote Config screen is entered B. An unconfigured parameter key is called C. Hackle SDK initialization failure D. Invalid or non-existent identifier information is provided E. ETC

  • To correctly retrieve the configured value, the defaultValue you enter and the type configured on the Hackle Remote Config parameter screen must match.

  • The Remote Config parameter types provided by the SDK are string, number, and boolean. The JSON type configured on the Remote Config parameter screen can be received as a string (String). The default value for JSON type must be entered as a string type.

Last updated