Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AGCRCService

Hierarchy

Index

Properties

Private cls_ServiceAGCRemoteConfig

cls_ServiceAGCRemoteConfig: string = "org/cocos2dx/javascript/service/ServiceAGCRemoteConfig"

listener

listener: RemoteConfigListener = null

support

support: boolean

Methods

applyLastFetched

  • applyLastFetched(): void
  • en

    Corresponding to loadLastFetched + apply methods of the Java SDK. Obtains the cached data that is successfully fetched last time, and applies parameter values.

    zh

    对应 Java 层 loadLastFetched + apply 方法,获取最近一次拉取成功的缓存数据,并生效配置参数

    Returns void

clearAll

  • clearAll(): void
  • en

    Clears all cached data, including the data fetched from Remote Configuration and the default values passed.

    zh

    清除所有的缓存数据,包括从云测拉取的数据和传入的默认值

    example
    huawei.agc.rc.rcService.clearAll();
    

    Returns void

fetch

  • fetch(intervalSeconds?: number): void
  • en

    Developers can also call the fetch method to get the setRemoteConfigListener callback, and then call the applyLastFetched method to apply parameter values from the cloud. But it is recommended to use the fetchAndApply method.

    zh

    开发者也可以通过调用 fetch 方法获取 setRemoteConfigListener 回调,然后再调用 applyLastFetched 方法来更新参数值。但还是建议使用 fetchAndApply 方法。

    Parameters

    • Default value intervalSeconds: number = -1

      Interval for fetching data, the unit is seconds, default value is -1 for 12 hours.

    Returns void

fetchAndApply

  • fetchAndApply(intervalSeconds?: number): void
  • en

    The Remote Configuration plug-in add the fetchAndApply method, corresponding to fetch + apply methods of the Java SDK. It is recommended to use this method to fetch and apply parameter values from the cloud. Developers can get the failure callback from setRemoteConfigListener. No callback in case of success.

    zh

    远程配置服务插件封装了 fetchAndApply 方法,对应 Java SDK 的 fetch + apply 方法。 建议使用 fetchAndApply 方法来获取和更新云端参数值到本地。若获取配置数据失败,开发者可以通过 setRemoteConfigListener 监听器返回失败回调,获取更新成功的情况下不会返回回调

    example
    huawei.agc.rc.rcService.fetchAndApply();
    

    Parameters

    • Default value intervalSeconds: number = -1

      Interval for fetching data, the unit is seconds, default value is -1 for 12 hours.

    Returns void

getMergedAll

  • getMergedAll(): any
  • en

    Returns all values obtained after the combination of the default values and values in Remote Configuration. If they have a same Key, the values in Remote Configuration is preferred.

    zh

    开发者可以获取全部本地默认值和云端参数值,若本地数据与云端数据的 Key 值相同,将获取该 Key 值的云端参数值。返回值为 JSON 对象。

    example
    let values = huawei.agc.rc.rcService.getMergedAll();
    console.log('Get all configs : ' + JSON.stringify(values));
    

    Returns any

    All values merged

getSource

  • getSource(key: string): number
  • en

    Returns the source of a key.

    zh

    返回 Key 对应的来源

    example
    let source = huawei.agc.rc.rcService.getSource('test');
    console.log('Get source by key : test, source : ' + source);
    

    Parameters

    • key: string

      Key of a parameter specified in Remote Configuration.

    Returns number

    Source of the key

getValueAsBoolean

  • getValueAsBoolean(key: string): boolean
  • en

    Returns the value of the boolean type for a key.

    zh

    返回 Key 对应的 Boolean 类型的 Value 值

    Parameters

    • key: string

      Key of a parameter specified in Remote Configuration.

    Returns boolean

    Value of a parameter specified in Remote Configuration.

getValueAsDouble

  • getValueAsDouble(key: string): number
  • en

    Returns the value of the Double (Java layer) type for a key.

    zh

    返回 Key 对应的 Java 侧 Double 类型的 Value 值

    Parameters

    • key: string

      Key of a parameter specified in Remote Configuration.

    Returns number

    Value of a parameter specified in Remote Configuration.

getValueAsLong

  • getValueAsLong(key: string): number
  • en

    Returns the value of the Long (Java layer) type for a key.

    zh

    返回 Key 对应的 Java 侧 Long 类型的 Value 值

    Parameters

    • key: string

      Key of a parameter specified in Remote Configuration.

    Returns number

    Value of a parameter specified in Remote Configuration.

getValueAsString

  • getValueAsString(key: string): string
  • en

    Returns the value of the string type for a key.

    zh

    返回 Key 对应的 String 类型的 Value 值

    example
    let value = huawei.agc.rc.rcService.getValueAsString('test');
    console.log('Get config by key : test, value :' + value);
    

    Parameters

    • key: string

      Key of a parameter specified in Remote Configuration.

    Returns string

    Value of a parameter specified in Remote Configuration.

setDeveloperMode

  • setDeveloperMode(isDeveloperMode: boolean): void
  • en

    Enables the developer mode, in which the number of times that the client obtains data from Remote Configuration is not limited, and traffic control is still performed over the cloud.

    zh

    用于设置开发者模式,不限制客户端获取数据的次数,但云端仍将进行流量控制。

    example
    huawei.agc.rc.rcService.setDeveloperMode(true);
    

    Parameters

    • isDeveloperMode: boolean

      Indicates whether to enable the developer mode.

    Returns void

setRemoteConfigListener

  • en

    set the listener for remote config

    zh

    设置远程配置监听

    Parameters

    Returns void

Static callStaticMethod

  • callStaticMethod(...args: (number | boolean | string)[]): any

Generated using TypeDoc