To use Hive functions in the game, you must initialize Hive SDK. After initialization, Terms of Service as well as update and notice popups registered on Hive console are automatically exposed.
How Hive SDK Initialization works
When Hive SDK is initialized, it performs the following functions:
- Hive SDK initializes the following items with one initialization function.
- Authentication: Initializes Hive Client and authenticates user IdP
- Promotion: Does advertisement and issues coupons
- Notification: Manages and sets push messages to users
- Marketing Attribution: Supports total management of third-party module which traces user data, such as the number of players through advertisement and event analysis
- Get grant access permission for app from users by OS type.
- Expose if Android 6.0 and later on Android-base devices.
- Expose in Korean if country IP is Korea on iOS-base devices.
- From Hive SDK v4.12.1, you can select to unveil or veil the permission notice popup by calling
Configuration.setHivePermissionViewOn()
method or by editing hive_config.xml file. This feature shorts the step from game start to access to game lobby, and default setting istrue
. If you selectfalse
, make sure to inform the access permission notice to app in market description. - How to set on hive_config.xml file
123456<!-- Unveil the permission notice popup. --><hivePermissionViewOn> true </hivePermissionViewOn><!-- Veil the permission notice popup. --><hivePermissionViewOn> false </hivePermissionViewOn> - How to set on API
Unity®1234// Unveil the permission notice popup.Configuration.setHivePermissionViewOn(true);// Veil the permission notice popup.Configuration.setHivePermissionViewOn(false);C++1234// Unveil the permission notice popup.hive::Configuration::setHivePermissionViewOn(true);// Veil the permission notice popup.hive::Configuration::setHivePermissionViewOn(false);Android1234// Unveil the permission notice popup.Configuration.setHivePermissionViewOn(true);// Veil the permission notice popup.Configuration.setHivePermissionViewOn(false);iOS1234// Unveil the permission notice popup.[HIVEConfiguration setHivePermissionViewOn:YES];// Veil the permission notice popup.[HIVEConfiguration setHivePermissionViewOn:NO]; - Expose the update and notice popups set for the relevant game.
- Check the user IP and expose Terms of Service by country.
Hive SDK Initialization
To initialize Hive Client, implement initialize()
method of Auth class. The result of calling the method is delivered through AuthInitResult
class. Following table describes the field of AuthInitResult
class.
Field Name | Description | Example |
isAuthorized | Whether account login is available or not | true |
loginType | Available login type on Hive | LoginType.GUEST |
did | Unique device identifier issued by Hive authentication server to verify Hive login | 123456 |
isPGSLogin | Whether Google Play Games is available to sign in (Android only) | true |
playerName | Profile name on Google Play Games (Android only) | “i’m pgs user” |
playerId | User account of Google Play Games (Android only) |
Followings are sample codes to initialize Hive Client.
API Reference: hive.Auth.initialize
1 2 3 4 5 6 7 8 9 10 11 12 |
// Callback handler managing the result of initializing Hive SDK. public void onAuthInitializeCB(ResultAPI result, AuthInitResult authInitResult) { if (result.isSuccess ()) { // Tasks to process after success in initializing Hive SDK. } } // Request to initialize Hive SDK. hive.Auth.initialize (onAuthInitializeCB); |
API Reference: Auth::initialize
1 2 3 4 5 6 7 8 9 10 11 12 |
// Request to initialize Hive SDK. Auth::initialize( [=](ResultAPI result, AuthInitResult authInitResult){ // Callback function managing the result of initializing Hive SDK. if(result.isSuccess()){ // Tasks to process after success in initializing Hive SDK. } } ); |
API Reference: com.hive.Auth.initialize
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Request to initialize Hive SDK. com.hive.Auth.initialize( new Auth.AuthInitializeListener() { // Callback listener managing the result of initializing Hive SDK. @Override public void onAuthInitialize(final ResultAPI result, final AuthInitResult authInitResult) { if(result.isSuccess()){ // Tasks to process after success in initializing Hive SDK. } } }); |
API Reference: HIVEAuth::initialize:
1 2 3 4 5 6 7 8 9 10 |
// Request to initialize Hive SDK. [HIVEAuth initialize:^(HIVEResultAPI* result, HIVEAuthInitResult *authInitResult) { // Callback handler managing the result of initializing Hive SDK. if (result.isSuccess) { // Tasks to process after success in initializing Hive SDK. } }]; |
Hive for New Corporate
From Hive SDK v4.11.4, any game company can use Hive platform. Hive had serviced GAMEVIL and Copm2uS only. However, the global game platform, Hive is now available to new corporates.
Available Resources
When a new corporate publishes a game with Hive platform, following resources are available to modify.
- With Unity engine
- Build your project on the engine, and then create an asset catalog (.xcassets) on your Xcode project.
-
Save your company logo in the asset catalog, and attach the logo on Terms of Service or Permission notice popup.
-
Make sure to comply with the following rules to set the name and size of your company’s logo file.
-
File name: auth_logo
-
File name: auth_copyright
-
File size: 270*11
Customizing Access Permission Screen to App
Screen design
Hive SDK provides automatic display of permission notice when implementing setup()
method in the AuthV4 class or initialize()
method in the Auth class. If you’d like to customize notice popup rather than using the default version, however, read the following guide to design game-friendly UI.
![]() |
![]() |
How to use
Localized resource file required to notify permission is available if you use getPermissionVeiwData()
method in the Configuration class prior to implementing initialization function such as setup()
method in the AuthV4 class or initialize()
method in the Auth class. This API reads Permissions.zip resource file, suitable for the target language, and composes PermissionVeiwData as string type.
Make sure to add the Permissions.zip file to Xcode project before implementing this API on iOS. On Android, it is optional to add the resource file. If you want to edit texts in the resource file, add the Permissions.zip file to your project as mentioned for iOS. If not added, permission notice data is composed of default resources included in Hive SDK. This feature is available with Hive SDK v4.12.1 and later. If your SDK is earlier than v4.12.1, click here to read details to use this feature with requestPermissionViewData()
method.
Refer to the following sample codes how to implement getPermissionViewData()
method.
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 |
HIVELanguage language = HIVELanguage.HIVELanguageEN; /* Supported language list. HIVELanguageDE, // German HIVELanguageEN, // English HIVELanguageES, // Spanish HIVELanguageFR, // French HIVELanguageID, // Indonesian HIVELanguageIT, // Italian HIVELanguageJA, // Japanese HIVELanguageKO, // Korean HIVELanguagePT, // Portuguese HIVELanguageRU, // Russian HIVELanguageTH, // Thai HIVELanguageTR, // Turkish HIVELanguageVI, // Vietnamese HIVELanguageZHS, // Chinese simplified HIVELanguageZHT // Chinese traditional */ PermissionViewData data = Configuration.getPermissionViewData(language); // language means enum HIVELanguage. //TODO : contents title : data.contents for (int i = 0; i < data.permissions.Count; i++) { /* TODO : permission name : data.permissions[i].nativePermissionName title : data.permissions[i].title contents : data.permissions[i].contents category : data.permissions[i].permissionCategory */ } for (int i = 0; i < data.commons.Count; i++) { /* TODO : data.permissions exists only when permission notice is at least one. permission name : data.commons[i].nativePermissionName title : data.commons[i].title contents : data.commons[i].contents category : data.commons[i].permissionCategory */ } |
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 |
HIVELanguage language = HIVELanguage.HIVELanguageEN; /* Supported language list. HIVELanguageDE, // German HIVELanguageEN, // English HIVELanguageES, // Spanish HIVELanguageFR, // French HIVELanguageID, // Indonesian HIVELanguageIT, // Italian HIVELanguageJA, // Japanese HIVELanguageKO, // Korean HIVELanguagePT, // Portuguese HIVELanguageRU, // Russian HIVELanguageTH, // Thai HIVELanguageTR, // Turkish HIVELanguageVI, // Vietnamese HIVELanguageZHS, // Chinese simplified HIVELanguageZHT // Chinese traditional */ PermissionViewData data = hive::Configuration::getPermissionViewData(language); //language means enum HIVELanguage. //TODO : contents title : data.contents.c_str() for (auto unit : data.permissions) { /* TODO : permission name : unit.nativePermissionName.c_str() title : unit.title.c_str() contents : unit.contents.c_str() category : unit.permissionCategory */ } for (auto unit : data.commons) { /* TODO : data.permissions exists only when permission notice is at least one. permission name : unit.nativePermissionName.c_str() title : unit.title.c_str() contents : unit.contents.c_str() category : unit.permissionCategory */ } |
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 |
Configuration.HIVELanguage language = Configuration.HIVELanguage.HIVELanguageEN; /* Supported language list. HIVELanguageDE("de"), // German HIVELanguageEN("en"), // English HIVELanguageES("es"), // Spanish HIVELanguageFR("fr"), // French HIVELanguageIN("in"), // Indonesian HIVELanguageIT("it"), // Italian HIVELanguageJA("ja"), // Japanerse HIVELanguageKO("ko"), // Korean HIVELanguagePT("pt"), // Portuguese HIVELanguageRU("ru"), // Russian HIVELanguageTH("th"), // Thai HIVELanguageTR("tr"), // Turkish HIVELanguageVI("vi"), // Vietnamese HIVELanguageZHS("zh-hans"), // Chinese simplified HIVELanguageZHT("zh-hant"); // Chinese traditional */ PermissionView.PermissionViewData data = Configuration.getPermissionViewData(language); //language is enum HIVELanguage. //TODO : contents title : data.contents for (PermissionView.PermissionViewUnitData permissionViewUnitData : data.permissions) { /* TODO : permission name : permissionViewUnitData.nativePermissionName title : permissionViewUnitData.title contents : permissionViewUnitData.contents category : permissionViewUnitData.Category */ } for (PermissionView.PermissionViewUnitData commonUnitData : data.commons) { /* TODO : data.permissions exists only when permission notice is at least one. permission name : commonUnitData.nativePermissionName title : commonUnitData.title contents : commonUnitData.contents category : commonUnitData.Category */ } |
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 |
HIVELanguage language = kHIVELanguageEN; /* Supported language list. kHIVELanguageDE, // German kHIVELanguageEN, // English kHIVELanguageES, // Spanish kHIVELanguageFR, // French kHIVELanguageID, // Indonesian kHIVELanguageIT, // Italian kHIVELanguageJA, // Japanese kHIVELanguageKO, // Korean kHIVELanguagePT, // Portuguese kHIVELanguageRU, // Russian kHIVELanguageTH, // Thai kHIVELanguageTR, // Turkish kHIVELanguageVI, // Vietnamese kHIVELanguageZHS, // Chinese simplified kHIVELanguageZHT, // Chinese traditional */ HIVEPermissionViewData* data = [HIVEConfiguration getPermissionViewData:language]; //language is enum HIVELanguage. //TODO : contents title : [data contents]]; for (HIVEPermissionViewUnitData *unit in [data permissions]) { /* TODO : permission name : [unit nativePermissionName] title : [unit title] contents : [unit contents] category : [unit permissionCategory] */ } for (HIVEPermissionViewUnitData *unit in [data commons]) { /* TODO : [data permissions] exists only when permission notice is at least one. permission name : [unit nativePermissionName] title : [unit title] contents : [unit contents] category : [unit permissionCategory] */ } |
Designing permission notice UI with PermissionViewData
- Composing UI with data
If you requestgetPermissionViewData()
method, you can obtain PermissionViewData which is composed of data that forms permission notice UI. In PermissionViewData, PermissionViewUnitData explains each permission as a list format.- PermissionViewData
Data name Data type Meaning Exposure to UI contents String It explains authority notice popup. Display on UI. O permissions Linear list or array
(depending on language)It is linear list or array contained the description and name of each permission. In case new permissions may be added according to OS update or legal policy, design the flexible list, for example, the UI counting data can include various types of values. For more details about data, refer to the following PermissionViewUnitData. Some part of them, O commons Linear list or array
(depending on language)It is linear list or array contained the description and name of common item. Make sure to include at least one permission notice to use commons data. For more details about data, refer to the following PermissionViewUnitData. O - PermissionViewUnitData
Data name Data type Meaning title String Permission name to expose to UI. contents String Permission details to expose to UI. It explains how to use the permission. nativePermissionName String Permission name used by each OS. permissionCategory enum Permission types not exposed to UI. It describes the permission in use and the function which permission uses. You can use this data by displaying some contents you want on permission UI. To check the permission list, refer to the source code.
- PermissionViewData
- UI sample
Following is a sample UI which is composed by callinggetPermissionViewData()
. See the sample image and design suitable UI for your game.
- Managing authority notice
getPermissionViewData()
method in the Configuration class is newly provided to have the customizing permission notice popup your own way. It only processes a function to compose permission notice data. It means that you can specify how to implement the process. For example, you can determine whether to expose the popup the first time only or at every update.Hive sets to display the popup the first time. If you comply with the Hive policy, make sure to code the following yellow parts with the new API. To check the function of country verification by IP, refer to the server API.
Texts
Depending on the access level, required/optional access permision is displayed. Add and inform the access permission which game requires.
iOS
According to Act on Promotion of Information and Communication Network Utilization and information Protection, permission should be exposed prior to request, and the case of iOS displays the permission popup only to users in Korea. By following the iOS policy, which demands to request permissions at the time of use, three permissions, CAMERA, PHOTO and PUSH are default permissions to notify. CAMERA and PHOTO display permission request popup at the time of use, and PUSH requests at the time of initializing SDK. Even if user denies the permissions, the three optional permissions do not bother the game play.
- In your built-Xcode project, uncompress the Permissions.zip file and drag and drop to the subdirectory of the project to organize the resources. In Project > info > Localizations, 15 languages are available, and when you select Permission.strings file, checkmarks are needed for completion as you see in the following inspector video clip. After this, you can customize as you want.
- Add the title and explanation of the necessary permission in the available lists of Permission.strings. If you add fifteen language resouces in your Xcode project and prompt to change the Korean resource, for example, Hive SDK v4.12.1 changes the texts in permission notice popup only when you add or edit the texts or title in Permission.strings (Korean).
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051"Header_Title" = "Access authority notice for gameplay";"Header_OK" = "OK";"Camera_Title" = "(Optional)Camera";"Camera_Description" = "This authority is required to use camera for profile settings in your game.";"Photos_Title" = "(Optional)Photo";"Photos_Description" = "This authority is required to upload photos to the profile in your game.";"Push_Title" = "(Optional)Push";"Push_Description" = "This authority is required to receive push messages from the game.";"AppleMusic_Title" = "Apple Music test for additional authority";"AppleMusic_Description" = "This content is to test additional authority for Apple Music.";"Common_Title" = "";"Common_Description" = "You can still use the service without agreeing to the optional permissions.";"Bluetooth_Title" = "";"Bluetooth_Description" = "";"Calendar_Title" = "";"Calendar_Description" = "";"Health_Title" = "";"Health_Description" = "";"Home_Title" = "";"Home_Description" = "";"Location_Title" = "";"Location_Description" = "";"Microphone_Title" = "";"Microphone_Description" = "";"Motion_Title" = "";"Motion_Description" = "";"Reminders_Title" = "";"Reminders_Description" = "";"Siri_Title" = "";"Siri_Description" = "";"SpeechRecognition_Title" = "";"SpeechRecognition_Description" = "";"TVProviderAccount_Title" = "";"TVProviderAccount_Description" = "";
- After successful addition, the permission in detail is displayed when user executes the app for the first time.
Android
By following the Android policy, PHONE is a default permission of Hive SDK permission notice and the access permission notice to OS on devices with Android 6.0 (API Level 23) and later version. PHONE, a default permission to notify, requests to identify device ID at the time of item rewards from game events. Even if user denies the permission, the optional permission does not bother the game play.
If you want to use Android resources, uncompress the Permissions.zip file and copy and paste in ../res folder to customize as you want.
Due to specific featrue of Unity, it conflicts with permission notice resource that Hive SDK contains. Therefore, make sure to add the version at the end of folder name, copy and paste the folder to use permission notice resouces for customization in advance. Refer to the following .gif files for using the resources.
-
Android
-
Cocos2d-x
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 |
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="hive_permission_ui_title">Access authority notice for gameplay</string> <string name="hive_permission_ui_ok">OK</string> <!-- PermissionGroup 'PHONE' --> <string name="hive_permission_phone_title">(Optional)PHONE</string> <string name="hive_permission_phone_desc">The authority is required to use the device identifier when sending event rewards in the game.</string> <!-- PermissionGroup 'CONTACTS' --> <string name="hive_permission_contacts_title">(Optional)CONTACTS</string> <string name="hive_permission_contacts_desc">The authority is required to access your Contacts to find in-game friends.</string> <!-- PermissionGroup 'STORAGE' --> <string name="hive_permission_storage_title">(Optional)STORAGE</string> <string name="hive_permission_storage_desc">The authority is required to use an external memory storage for additional downloads.</string> <!-- PermissionGroup 'LOCATION' --> <string name="hive_permission_location_title">(Optional)LOCATION</string> <string name="hive_permission_location_desc">The authority is required to access your location.</string> <!-- PermissionGroup 'MICROPHONE' --> <string name="hive_permission_microphone_title">(Optional)MICROPHONE</string> <string name="hive_permission_microphone_desc">This authority is required to use the microphone in your device.</string> <!-- PermissionGroup 'CAMERA' --> <string name="hive_permission_camera_title">(Optional)CAMERA</string> <string name="hive_permission_camera_desc">This authority is required to take pictures and record video clips.</string> <!-- PermissionGroup 'SMS' --> <string name="hive_permission_sms_title">(Optional)SMS</string> <string name="hive_permission_sms_desc"></string> <!-- PermissionGroup 'CALENDAR' --> <string name="hive_permission_calendar_title">(Optional)CALENDAR</string> <string name="hive_permission_calendar_desc"></string> <!-- PermissionGroup 'SENSORS' --> <string name="hive_permission_sensors_title">(Optional)SENSORS</string> <string name="hive_permission_sensors_desc"></string> <!-- PermissionGroup 'COMMON' --> <string name="hive_permission_common_title"></string> <string name="hive_permission_common_desc">You can still use the service without agreeing to the optional permissions.</string> </resources> |