本演示项目在Unity for Android Build中启用部分华为HMS和AGC服务,对应的类和函数的名称和用法相同。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

6.4 KiB

HuaweiService.RemoteConfig

Scenario: Application configuration items应用配置项

Description Api Reference
Sets a default value for a parameter.
设置默认参数(resId)
applyDefault(int resId) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig
The resId cannot be obtained like Android. The specific usage is explained in manual "3).Optional: Using an XML resource file".

Example
Sets a default value for a parameter.
设置默认参数(Map)
applyDefault(Map<String, Object> map) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Applies parameter values.
生效配置参数
apply(ConfigValues values) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Returns all values obtained after the combination of the default values and values in Remote Configuration.
云端值与默认值合并
getMergedAll() https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example

Scenario: Get the cloud parameters获取云端参数

Description Api Reference
Fetches latest parameter values from Remote Configuration at the default interval of 12 hours. If the method is called within an interval, cached data is returned.
获取云端配置项,默认间隔
fetch() https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Fetches latest parameter values from Remote Configuration at a customized interval. If the method is called within an interval, cached data is returned.
获取云端配置项,自定义间隔
fetch(long intervalSeconds) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Returns the value of the boolean/double/long/string/byte type for a key.
返回key对应的value值
getValueAsBoolean(String key)/getValueAsDouble(String key)/getValueAsLong(String key)/getValueAsString(String key)/getValueAsByteArray(String key) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Obtains the cached data that is successfully fetched last time.
获取上一次缓存数据
loadLastFetched() https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example
Returns the source of a key.
返回Key对应的来源
getSource(String key) https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-References/agconnectconfig

Example

Scenario: Clear cached data清除缓存数据

Description Api Reference
Clears all cached data, including the data fetched from Remote Configuration and the default values passed.
清除数据
clearAll() agconnectconfig

Example

Scenario: Set up developer mode设置开发者模式

Description Api Reference
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.
设置开发者模式
setDeveloperMode(boolean isDeveloperMode) agconnectconfig

Example