How you implement Hive depends on the game engine you use and the platform on which the game app runs. Regardless of the engine or platform, the settings for Hive are defined in a file called hive_config.xml. The hive_config.xml file must be included in your game project. This file can be used to set the value easily. After game execution, you can modify the setting value at runtime by using the method in the Configuration class provided by Hive.
Search and Change the Configuration
Configuration in File
Hive SDK setting file has .xml format, and Hive Client refers values in this file when initializing SDK files. Static values are recommended to set in hive_config.xml file that do not change while the app is running. This configuration file name must be hive_config.xml and must be located in the following path.
– Unity 2021 and higher: <Project_route>/Assets/HiveSDK/hive.androidlib/src/main/res/raw
– Prior to Unity 2021: <Project_route>/Assets/Plugins/Android/res/raw/
Check the Items available to configure for more details of items and permissions.
Changing Hive Settings at runtime
Searching or changing Hive setting values are available as well while user plays a game. Configuration class provides the methods which add get
or set
on the name of each item. For example, getServerId()
is for searching, and setServerId()
is for changing the value of game server. Some items such as game language are for settings only. If you need more details, check the get or set permissions by item in the Item Information.
It is necessary to change Hive settings in the following cases.
- Before initializing Hive SDK
Set the game server or game language in the Configuration class before initializing Hive SDK. - When the user selects a game server before displaying Server Maintenance popup, after the Hive SDK initialization
After initializing the SDK, expose a UI to select game server. When the user selects a game server, use the API in the Configuration class and then display the Server Maintenance popup. - When game server or language is changed in game settings after user enters the game
You can provide a UI that allows user to change the game server or game language during game play – in the game settings, and so on. If user did change, use the API in the Configuration class for Hive settings as well. - When game data is changed in accordance with game planning
In case game information matched with Hive settings is changed except the cases above, make sure to use the API in the Configuration class.
If you change the value of zone field as real
by using the Configuration class and initialize the SDK even your configuration for the field in the .xml file is sandbox
, for instance, Hive runs based on the value of the API, real
. The value in the hive_config.xml file keeps its state as sandbox
.
The setZone
function operates normally when it is called before calling the setup
function.
Followings are sample codes to change zone field settings of users.
API Reference: hive.Configuration.setZone
1 2 |
// Even setting zone field as "sandbox" in hive_config.xml file, it implements the same with the setting as "real". hive.Configuration.setZone(ZoneType.REAL); |
API Reference: hive::Configuration::setZone
1 |
hive::Configuration::setZone(hive::ZoneType::REAL); |
API Reference: Configuration.setZone
1 |
Configuration.setZone(ZoneType.REAL); |
API Reference: HIVEConfiguration:setZone
1 |
[HIVEConfiguration setZone:kHIVEZoneTypeReal]; |
Configure Hive Theme
Dark Theme is available by using hiveDark
. The default value is hiveLight
.
API Reference: hive.Configuration.setHiveTheme
1 2 3 4 |
Configuration.setHiveTheme(HiveThemeType.hiveLight); Configuration.setHiveTheme(HiveThemeType.hiveDark); |
API Reference: hive::Configuration::setHiveTheme
1 2 3 4 |
hive::Configuration::setHiveTheme(hive::HiveThemeType::hiveLight); hive::Configuration::setHiveTheme(hive::HiveThemeType::hiveDark); |
API Reference: Configuration.setHiveTheme
1 2 3 4 |
Configuration.setHiveTheme(Configuration.HiveThemeType.hiveLight); Configuration.setHiveTheme(Configuration.HiveThemeType.hiveDark); |
API Reference: HIVEConfiguration:setHiveTheme
1 2 3 4 |
[HIVEConfiguration setHiveTheme:HIVEThemeTypeHiveLight]; [HIVEConfiguration setHiveTheme:HIVEThemeTypeHiveDark]; |
Set the log type
Hive Log Type is able configured by using the Logger.setLogFilter API. LogType.Verbose among the six types as below is the default setting value:
- LogType.Verbose: Output logs during development
- LogType.Debug: Detail logs on all steps
- LogType.Info: Show Hive SDK process steps and result callback (recommended)
- LogType.Warning: Errors that affect nothing on running the game even in an unexpected situation
- LogType.Error: Errors that omit the setting information and affect running games
- LogType.None: No output of any log
- The log types are determined from the high level to the low as shown below and output the lower types than the logs you set.
- Verbose > Debug > Info > Waring > Error > None
- This setting is only valid when the
useLog
item of Configuration class is set astrue
.
1 2 3 4 |
>LogFilter logFilter = new LogFilter(); logFilter.coreLog = hive.LogType.Info; logFilter.serviceLog = hive.LogType.Info; hive.Logger.setLogFilter(logFilter); |
1 2 3 4 5 |
LogFilter logFilter = new LogFilter(); logFilter.coreLog = LogType::Info; logFilter.serviceLog = LogType::Info; Logger.setLogFilter(logFilter); |
1 2 3 4 5 6 7 |
// Declare LogFilter LogFilter logFilter = new LogFilter(); logFilter.coreLog = LogType.Info; logFilter.serviceLog = LogType.Info; // Setting LogFilter Logger.setLogFilter(logFilter); |
1 2 3 4 5 6 7 |
// Declare LogFilter val logFilter = LogFilter() logFilter.coreLog = LogType.Info logFilter.serviceLog = LogType.Info // Setting LogFilter Logger.logFilter = logFilter |
1 2 |
HIVELogFilter* logFilter = [[HIVELogFilter alloc]initWithCoreLog:HIVELogTypeInfo serviceLog:HIVELogTypeInfo]; [HIVELogger setLogFilter:logFilter]; |
1 2 |
let logFilter = LogFilter.init(coreLog:LogType.Info, serviceLog: LogType.Info) LogInterface.setLogFilter(logFilter) |
Items available to configure
Item Information
Items highlighted in blue are available to manage in the configuration file. Functions are also provided for some items to use as methods in the Configuration class.
Item | Description | Function | ||||
appId | The identifier of the game build. If this entry is not present, the app’s default package name is used on Android, and bundle ID on iOS. | get set |
||||
serverId | The identifier of each game server when the game is operated by separate servers by region. Make sure to be created according to the Hive Identifier Policy. | get set |
||||
zone | The type of server which Hive Client connects with.
|
get set |
||||
useLog | Whether to activate the internal operation log of the Hive client.
|
get set |
||||
ageGateU13 | Whether to activate COPPA with Hive SDK.
|
get set |
||||
permissions |
Whether to ask the user to accept the permissions by type. Android only. derpecated from SDK v4.16.3
|
get set |
||||
company | Game publishing company.
|
get set |
||||
companyIndex | Game publishing company indicated by index. The registered companyIndex is received through a communication with provisioning server, and sent to analytics log. Game studios have nothing to configure. | – | ||||
channel | Login service platform that game app uses.
|
get | ||||
market | Market to pay for the in-app purchase.
|
get | ||||
httpConnectTimeout | HTTP Connect timeout (second), which is used inner parts of Hive Client. Default value is 8 seconds, and it is not allowed to change unless unavoidable circumstances. | get set |
||||
httpReadTimeout | HTTP Read timeout (second), which is used inner parts of Hive Client. Default value is 8 seconds, and it is not allowed to change unless unavoidable circumstances. | get set |
||||
maxGameLogSize | The maximum queue size of game log, which stores unstructured data collected from Hive Analytics v2. Default size is 50, and it is not allowed to change unless unavoidable circumstances. | get set |
||||
providers | The collection of settings for third party libraries. | – | ||||
The element, which belongs to <providers>, defines the settings about Facebook for verification with Authentication v4. (+4.14.0) When using Facebook SDK, if you need permissions other than |
– | |||||
The element, which belongs to <providers>, adds the settings about Google for verification with Authentication v4. (+4.14.0) | – | |||||
The element, which belongs to <providers>, adds the settings about WeChat for verification with Authentication v4. (+4.14.0) | – | |||||
The element, which belongs to <providers>, adds the settings about QQ for verification with Authentication v4. (+4.14.0) | – | |||||
vk | The element, which belongs to <providers>, adds the settings about VK for verification with Authentication v4. (+4.14.0) | – | ||||
line | The element, which belongs to <providers>, adds the settings about LINE for verification with Authentication v4. (+4.14.0) | – | ||||
weverse | The element, which belongs to <providers>, adds the settings about Weverse for verification with Authentication v4. (+4.15.2) | – | ||||
signinwithapple | The element, which belongs to <providers>, adds the settings about Sign in with Apple for verification with Authentication v4. (This item is used for signing in with the Apple account on Android.) (+4.15.6) | – | ||||
Adjust | An element of <providers> and it adds configurations for the market performance analytics tool Adjust. (+4.14.0) | – | ||||
Singular | An element of <providers> and it adds configurations for the market performance analytics tool Singular. (+4.14.0) | – | ||||
AppsFlyer | An element of <providers> and it adds configurations for the market performance analytics tool AppsFlyer. (+4.14.0) | – | ||||
Firebase | An element of <providers> and it adds configurations for the market performance analytics tool Firebase Analytics. (+4.16.1) | – | ||||
trackers | The collection of settings for third party attributions. (deprecated with SDK 4.14.0 and later) | – | ||||
tracker | The element, which belongs to <trackers>, defines the settings about one of Third Party Attribution. (deprecated with SDK 4.14.0 and later) | – | ||||
qqAppId | QQ AppID to sign in QQ in the game with Authentication v4 (+v4.5.0). (deprecated with SDK 4.14.0 and later) | – | ||||
vkAppId | VK AppID to sign in VK in the game with Authentication v4 (+v4.6.0). (deprecated with SDK 4.14.0 and later) | – | ||||
wechatAppId | WeChat AppID to sign in VK in the game with Authentication v4 (+v4.6.0). (deprecated with SDK 4.14.0 and later) | – | ||||
echatAppSecret | The value of WeChat App Secret to sign in WeChat in the game with Authentication v4 (+v4.6.0). (deprecated with SDK 4.14.0 and later) | – | ||||
wechatPaymentKey | The value of WeChat Payment Key which is used to pay on WeChat (+v4.7.0). (deprecated with SDK 4.14.0 and later) | – | ||||
facebookPermissions | Additional permissions required for Facebook Login (+v4.9.0, 4.5.4, 4.6.3, 4.7.2, 4.8.1). Adding no key (facebookPermissions): Adding key without value: Adding both key and value: (deprecated with SDK 4.14.0 and later) |
– | ||||
exitEventEnabled | exitEvent is an event that notifies you that the app needs to be terminated by the the game studio directly, not by the Hive SDK. If this value is True, you will receive this event and the Hive SDK will not directly terminate the game app at this time. If this value is False, the Hive SDK can directly terminate the game app.(+v4.9.0) (deprecated since SDK 4.16.4). | – | ||||
analyticsSendLimit | The maximum amount of log to send in every log sending cycle. Default is 5 (+v4.11.0). | get set |
||||
analyticsQueueLimit | The maximum amount of log to queue. Default is 50 (+v4.11.0). | get set |
||||
analyticsSendCycle | Log sending cycle. Analytics log is sent in every setting cycle, available to set by second. Default is one second (+v4.11.0). |
get set |
||||
useCrashReport |
As an iOS-only function, it detects the situation immediately before the app is forced to close (crash) due to an error and saves the Hive Analytics log that is waiting to be transmitted to server as a file. When using an external third-party crash reporter that provides a similar function, it must be disabled by setting it to false to prevent crashes. (+v4.16.0) (derpecated since v4.16.3) |
– | ||||
saveAnalyticsLogBeforeCrash | This is an iOS-only feature. The Hive analytics saves the pending logs (being held without transmitted to the server) into a file before the app is forcibly terminated due to a NSException type error or a Unix singal type error by recognizing the situation. When using an external 3rd party crash reporter, it must be disabled by setting it to false to prevent crashes. The useCrashReport used in 4.16.3 or before is replaced with the saveAnalyticsLogBeforeCrash .(+v4.16.3) |
– | ||||
googleClientId | The value of iOS – Google Client ID required for Google sign-in on iOS (Auth v1: v4.5.0+, Auth v4: v4.11.0+). (deprecated with SDK 4.14.0 and later) | – | ||||
googleServerClientId | The client ID of web application required for Google Play sign-in on Authentication v4-based games (Android: v4.5.0+, iOS: v4.11.0+). (deprecated with SDK 4.14.0 and later) | – | ||||
hiveSDKVersion | The version of Hive SDK. | get | ||||
referenceSDKVersion | The version of SDK which Hive SDK refers to. | get | ||||
gameLanguage | The game language set on the Hive SDK. | set | ||||
hiveCountry | The country code which Hive SDK server decides. | get | ||||
hivePermissionViewOn | Setting whether to display Hive SDK permission notice popup (+4.12.1).
|
set |
Example of hive_config.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
<properties> <useAuthv1>false</useAuthv1> <useAuthv4>true</useAuthv4> <appId>com.com2us.hivesdk.normal.freefull.apple.global.ios.universal</appId> <gameLanguage>en</gameLanguage> <!-- Select a server of Hive Platform; sandbox for test, real for common use (sandbox, real) --> <zone>sandbox</zone> <!-- Set whether to use SDK internal action log (true, false) --> <useLog>true</useLog> <!-- Set whether to use Push through Hive SDK (true, false) --> <usePush>false</usePush> <!-- Company settings (C2S: Com2uS, GVI: Com2uS Holdings) --> <company>C2S</company> <!-- Channel settings (C2S: Hive Platform) --> <channel>C2S</channel> <!-- Payment market settings (GO: Google Play, LE: Com2us Lebi, AP: Apple App Store) --> <market>GO</market> <!-- Set the unit of HTTP ConnectTimeout which internal Hive SDK uses as second (Do not change the value unless an exceptional case) --> <httpConnectTimeout>8</httpConnectTimeout> <!-- Set the unit of HTTP Read Timeout which internal Hive SDK uses as second (Do not change the value unless an exceptional case) --> <httpReadTimeout>8</httpReadTimeout> <maxGameLogSize>50</maxGameLogSize> <analyticsSendLimit>120</analyticsSendLimit> <analyticsQueueLimit>1200</analyticsQueueLimit> <analyticsSendCycle>1</analyticsSendCycle> <hivePermissionViewOn>true</hivePermissionViewOn> <universalLink>https://hiveota.withhive.com/hivesdk/normal/</universalLink> <providers> <!-- The facebook code below is just an example code to set permissions other than the ones that are automatically set by Hive SDK (email, public_profile) --> <!-- You must change this example code to set the permissions that you actually need as <permission> elements when you use hive_config.xml. --> <facebook> <permissions> <permission name="user_friends" /> <permission name="user_gender" /> </permissions> </facebook> <google playAppId="331526026701" clientId="331526026701-s41n272jsv6c0f72kt5o7of0jns350gl.apps.googleusercontent.com" serverClientId="331526026701-42uadtkeght91f7saspdg92gtdill6mv.apps.googleusercontent.com" reversedClientId="com.googleusercontent.apps.331526026701-s41n272jsv6c0f72kt5o7of0jns350gl" /> <googleplaygames playAppId="331526026701" clientId="331526026701-s41n272jsv6c0f72kt5o7of0jns350gl.apps.googleusercontent.com" serverClientId="331526026701-42uadtkeght91f7saspdg92gtdill6mv.apps.googleusercontent.com" reversedClientId="com.googleusercontent.apps.331526026701-s41n272jsv6c0f72kt5o7of0jns350gl" /> <qq id="1106227203" /> <vk id="6270065" /> <wechat id="wx78176cf0c698c0f9" secret="b5a73b0ee67d546bf876851944eda308" univeralLink="https://hiveota.withhive.com/hivesdk/normal/"/> <line channelId="1653399089" /> <weverse clientId="abcdefghijk123456789" /> <signinwithapple serviceid=”com.com2us.hivesdk” /> <!-- (Android Only) Set the service ID set in the Apple developer account as serviceid –-> <!-- User data tracking settings --> <Adjust> name="Adjust" id="unused" key="8szd9kddtt6o" secretId="1" info1="2071917595" info2="254356864" info3="427896519" info4="820983601"> <events> <event name="Purchase" value="py318i"/> <event name="TutorialComplete" value="gvfh2l"/> <event name="Update" value="sosx8y"/> </events> </Adjust> <Singular> name="Singular" id="com2ususa_dev_7705679f" key="9b7ff73a0fc13c6c9397a9881dba2673"> <events> <event name="Purchase" value="purchase"/> <event name="TutorialComplete" value="tutorial Complete"/> <event name="Update" value="update"/> </events> </Singular> <AppsFlyer> name="AppsFlyer" id="unused" key="G6yEQjHw4CrEN8sEzF9onU" itunesConnectAppId="1202135972"> <events> <event name="TutorialComplete" value="Tutorial Complete"/> <event name="Update" value="Update"/> </events> </AppsFlyer> <Firebase name="Firebase" id="unused" key="unused"> <events> <event name="Purchase" value="purchase"/> <event name="TutorialComplete" value="tutorial_complete"/> <event name="Update" value="update"/> <event name="Open" value="open"/> </events> </Firebase> </providers> </properties> |