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.
Initialization Process Details
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
- Starting from Hive SDK v4.16.2, the SDK does not notify app access rights directly. Check out the FAQ for more details.
- Expose the update and notice popups set for the relevant game.
- Check the user IP and expose Terms of Service by country.
Register Hive Certification Key
With the Configuration class API, register the Hive certification key issued on the Hive console page before the Hive initialization. The corresponding API is provided from version 4.15.0 or higher.
API Reference: Configuration.setHiveCertificationKey
1 2 3 4 |
// Hive Certification Key String hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"; // Register Hive Certification Key Configuration.setHiveCertificationKey(hiveCertKey); |
API Reference: Configuration::setHiveCertificationKey
1 2 3 4 |
// Hive Certification Key std::string hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"; // Register Hive Certification Key hive::Configuration::setHiveCertificationKey(hiveCertKey); |
API Reference: Configuration.setHiveCertificationKey
1 2 3 4 |
// Hive Certification Key String hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"; // Register Hive Certification Key Configuration.setHiveCertificationKey(hiveCertKey); |
API Reference: [HiveConfiguration setHiveCertificationKey:]
1 2 3 4 |
// Hive Certification Key NSString* hiveCertKey = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"; // Register Hive Certification Key [HIVEConfiguration setHiveCertificationKey: hiveCertKey]; |
Implement Initialization
To initialize Hive SDK, implement setup()
method in the AuthV4 class. Following data is delivered as a result, so you can save the data in the game and utilize it if needed.
- The Result Data of Hive Initialization
Field Name | Description | Example |
isAutoSignIn | Whether automatic login is available or not | true |
did | An identifier that abstracts the advertisement ID provided by the OS | 123456789 |
providerTypeList | Available IdP list for the current app It is essential field to use when customizing explicit login or composing the information of IdP sync status. |
ProviderType.FACEBOOK ProviderType.HIVE |
Followings are sample codes to implement setup()
method.
API Reference: hive.AuthV4.setup
1 2 3 4 5 6 7 8 9 10 11 |
// Request Hive SDK Initialization AuthV4.setup ((ResultAPI result, Boolean isAutoSignIn, String did, List providerTypeList) => { if (result.isSuccess()) { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if (result.needExit()) { // TODO: Implement the termination of the app // Example) Application.Quit(); } else { // initialization failed } }); |
API Reference: AuthV4::setup
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Request Hive SDK Initialization AuthV4::setup([=](ResultAPI const & result, bool isAutoSignIn, std::string did, std::vector<ProviderType> const & providerTypeList) { if (result.isSuccess()) { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if (result.needExit()) { // TODO: Implement the termination of the app // Users of the Cocos2d-x engine // ex) exit(0); // Unreal engine users // Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false); } else { // initialization failed } }); |
API Reference: com.hive.AuthV4.setup
1 2 3 4 5 6 7 8 9 |
// Request Hive SDK Initialization AuthV4.setup(object: AuthV4.AuthV4SetupListener{ override fun onAuthV4Setup(result: ResultAPI, isAutoSignIn: Boolean, did: String?, providerTypeList: ArrayList<AuthV4.ProviderType>?) { if (result.isSuccess) { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if (result.needExit()) { // TODO: Implement the termination of the app // ex) exitProcess(0) } else { // initialization failed } } }) |
API Reference: com.hive.AuthV4.setup
1 2 3 4 5 6 7 8 9 10 11 12 |
// Request Hive SDK Initialization AuthV4.setup(new AuthV4.AuthV4SetupListener() { @Override public void onAuthV4Setup(ResultAPI result, boolean isAutoSignIn, String did, ArrayList<AuthV4.ProviderType> providerTypeList) { if (result.isSuccess()) { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if (result.needExit()) { // TODO: Implement the termination of the app // ex) System.exit(0); } else { // initialization failed } } }); |
API Reference: HIVEAuthV4:setup
1 2 3 4 5 6 7 8 9 10 |
AuthV4Interface.setup { (result, isAutoSignIn, did, providerTypeList) in if result.isSuccess() { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if result.needExit() { // TODO: Implement the termination of the app // Example) exit(0) } else { // initialization failed } } |
API Reference: HIVEAuthV4:setup
1 2 3 4 5 6 7 8 9 |
// Request Hive SDK Initialization [HIVEAuthV4 setup:^(HIVEResultAPI *result, BOOL isAutoSignIn, NSString *did, NSArray<NSNumber *> *providerTypeList) { if (result.isSuccess) { // the initialization is successfully done. Handle login based on whether the auto-login is enabled or not. } else if (result.needExit) { // TODO: Implement the termination of the app // ex) exit(0); } else { // Initialization failed } }]; |
Notify App Access Permission
Screen design
Read this guide carefully if you want to change your pop-up to a game-specific custom pop-up that matches the game UI.
- Custom permission notice popup
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 Premissions.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 42 |
HIVELanguage language = HIVELanguage.HIVELanguageEN; /* Supported language list. HIVELanguageAR, // Arabic 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. HIVELanguageAR, // Arabic 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. HIVELanguageAR("ar"), // Arabic 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. kHIVELanguageAR, // Arabic 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 the iOS policy to request permission at the time of use, the 4 permissions, CAMERA, PHOTO, PUSH, and IDFA, are set as the default items for the app access permission notice. For the IDFA permission, a permission request pop-up is created when the Hive SDK is initialized. For the CAMERA and PHOTO permission, a permission request pop-up appears when the function is actually used. For the PUSH permission, it is requested when the SDK is initialized. All four items are optional, so there is no problem with game play even if the user refuses these requests for permission.
- In your built-Xcode project, uncompress the Permissions.zip file and drag and drop to the sub-directory 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 resources in your Xcode project and try 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" = "";
Android
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 feature 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 resources 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"></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> |
Server Maintenance Popups
For the game service, it is necessary to block the version after the update of the game client, or to block the game connection during the maintenance of the game server. Hive provides the functions to expose popups in the order of Forced game update, notification/server maintenance in accordance with the information configured in Hive Console. In the game, you can use the UI provided by Hive SDK or implement the customized UI by receiving the information from Hive.
Game Update by Force | Block to use the specific version of games and provide a link for update |
Server Maintenance | Available to set the maintenance status by game server, and recommended to provide official community links by game during the server maintenance |
Notice | Use to expose the important notice or update information not by force to all users |
If game server is more than one, the game server information selected or set by the user must be set in Hive. If the user needs to select a game server, implement the server selection UI to change the Hive setting by calling setServerId() method of the Configuration class before showing various types of popup. If you want to renew promotion-news data with changing Hive setting, call Configuration class updateServerId()
method instead of setServerId()
method.
After the game server is set up, you can expose a popup at any time. If you set a popup on Hive Console, it will block game access during maintenance time. Displaying popups are available to use the UI provided by Hive SDK or customize it based on the information from Hive. Server maintenance popup/update popup/notice popup are available to set for each game server.
Setting Popup Contents
Set the details of server maintenance popup/update popup/notice popup on Hive Console. For more information about settings, see Operation > Provisioning guide.
Displaying Popup
Hive displays maintenance popup/update popup/notice popup, or returns information of the popup messages for customizing the popup. If Hive displays it, the popup will appear in the Hive UI style, but if you want to do it yourself, you can display the popup in whatever style you want. Call the checkMaintenance() method in the AuthV4 class by setting the parameters as shown below depending on whether you are using Hive popups.
- A use of Hive-providing popups: Set
isShow
parameter astrue
. - A request for popup data to customize popups: Set
isShow
parameter asfalse
. For more information about popup data, see Popup Data Returned by Hive below.
The following is an example code that displays a server maintenance popup with the UI provided by the Hive. If a user closes this popup when the server maintenance has not been completed, the exit event will be fired and forwarded to ResultAPI result
.
API Reference: hive.AuthV4.checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Whether to use Hive SDK UI Boolean isShow = true; // Show Hive SDK server maintenance pop-up AuthV4.checkMaintenance(isShow, (ResultAPI result, List maintenanceInfoList) => { if (result.isSuccess()) { // if there is no maintenance data // if isShow is false } else if (result.needExit()) { // TODO: Implement the termination of the app // Example) Application.Quit(); } }); |
API Reference: AuthV4::checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// Whether to use Hive SDK UI bool isShow = true; // Show Hive SDK server maintenance pop-up AuthV4::checkMaintenance(isShow, [=](ResultAPI const & result,std::vector const & maintenanceInfolist){ if (result.isSuccess()) { // if there is no maintenance data registered // if isShow is false } else if (result.needExit()) { // TODO: Implement the termination of the app // Users of the Cocos2d-x engine // ex) exit(0); // Unreal engine users // Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false); } }); |
API Reference: com.hive.AuthV4.checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 |
// Whether to use Hive SDK UI val isShow = true // Show Hive SDK server maintenance pop-up com.hive.AuthV4.checkMaintenance(isShow, object : AuthV4MaintenanceListener { override fun onAuthV4Maintenance(result: ResultAPI, maintenanceInfo: ArrayList<AuthV4.AuthV4MaintenanceInfo>?) { if (result.isSuccess()) { // if there is no maintenance data registered // if isShow is false } else if (result.needExit()) { // TODO: Implement the termination of the app // Example) exitProcess(0) } }}) |
API Reference: com.hive.AuthV4.checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// Whether to use Hive SDK UI boolean isShow = true; // Show Hive SDK server maintenance pop-up com.hive.AuthV4.checkMaintenance(isShow, new AuthV4.AuthV4MaintenanceListener() { @Override public void onAuthV4Maintenance(ResultAPI result, ArrayList maintenanceInfo) { if (result.isSuccess()) { // if there is no maintenance data registered // if isShow is false } else if (result.needExit()) { // TODO: Implement the termination of the app // ex) System.exit(0); } } }); |
API Reference: HIVEAuthV4:checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Whether to use Hive SDK UI // Whether to use Hive SDK popup UI let isShow = YES; AuthV4Interface.checkMaintenance(isShow) { (result, maintenances) in if result.isSuccess() { // When there is no actual maintenance data // if isShow is false } else if result.needExit() { // TODO: Implement the termination of the app // Example) exit(0) } } |
API Reference: HIVEAuthV4:checkMaintenance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Whether to use Hive SDK UI // Whether to use Hive SDK popup UI BOOL isShow = YES; // Show Hive SDK server maintenance pop-up [HIVEAuthV4 checkMaintenance:isShow handler:^(HIVEResultAPI *result, NSArray<HIVEAuthV4MaintenanceInfo *> *maintenanceInfolist) { if (result.isSuccess) { // if there is no maintenance data registered // if isShow is false } else if (result.needExit) { // TODO: Implement the termination of the app // Example) exit(0); }}]; |
Popup Data Returned by Hive
If Hive receives request for the popup information set in Hive Console through the checkMaintenance() method, it returns the values summarized in the following table in the AuthV4MaintenanceInfo object, and if this value is returned as null, there is no content to pop up.
- Details of
AuthV4MaintenanceInfo
object
Field Name Description Type title Popup title String message Popup contents String button Text for the label of popup button String action Action type when a user taps the popup button - OPEN_URL: Execute URL passed by external browser
- EXIT: End the app
- DONE: Just close maintenance popup
Enumeration type of AuthV4MaintenanceActionType url URL displayed by external browser. This is valid when the value of action
field is OPEN_URLString remainingTime Remaining time until maintenance completion (Unit: second). Time refreshes in real time and when it becomes zero, app is terminated. Integer
Hive WebView
Terms of Service
At the time of initialization, Hive SDK expose Terms of Service (“Terms”) that are appropriate for the country determined by the user’s access IP and game development company automatically. Even so, the game should provide links for Terms and Privacy Policy to all users regardless of consent to Terms and Privacy Policy. If you use the link provided by Hive, the proper Terms and Policy are automatically selected to expose to users depending on the setting on Hive Console. The regulations how to indicate a link of Terms and Policy are different by game development company.
To display Terms of Service when click the button or link, call showTerms()
method of AuthV4 class. Followings are sample codes.
API Reference: hive.AuthV4.showTerms
1 2 3 4 5 6 7 8 |
// Listener managing the Terms of service exposure notification public void onAuthV4ShowTerms(ResultAPI result) { Logger.log("AuthV4TestView.onAuthV4ShowTerms() Callback\nresult = " + result.toString() + "\n"); } // Request to display terms AuthV4.showTerms(onAuthV4ShowTerms); |
API Reference: AuthV4::showTerms
1 2 3 4 5 6 7 8 9 |
// Request to display Hive SDK AuthV4 terms AuthV4::showTerms([=](ResultAPI const & result) { // Result callback if (result.isSuccess()) { // Close the terms screen } else { // TODO : Error Handling } }); |
API Reference: com.hive.AuthV4.showTerms
1 2 3 4 5 6 |
com.hive.AuthV4.showTerms(new com.hive.AuthV4.AuthV4ShowTermsListener() { @Override public void onAuthV4ShowTerms(ResultAPI result) { } }); |
API Reference: HIVEAuthV4::showTerms
1 2 3 4 5 6 7 8 9 10 11 12 |
// Display terms // Request to display terms [HIVEAuthV4 showTerms:^(HIVEResultAPI *result) { Loggerd(@"HIVEAuthV4.showTerms:\nresult = %@", result); if (result.isSuccess) { } else { } }]; |
User Profile
Game users can express their personality through profile images and display names. They can change their profile image and nickname as they want.
Every user has a profile page, and they can edit their profile image and nickname on the profile page. Only Hive membership users are available to edit the profile. If users connect with IdPs such as Facebook, which returns the profile image or nickname, user data from the IdP will be used on Hive.
To expose the profile page, call showProfile()
method in the AuthV4 class.
Followings are sample codes to display the user profile.
API Reference: hive.AuthV4.showProfile
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Show Hive SDK Profile webview // using hive // Hive SDK result callback handler public void onAuthV4ShowProfile(ResultAPI result) { Logger.log("AuthV4TestView.onAuthV4ShowProfile() Callback\nresult = " + result.toString() + "\n"); } // User's PlayerId Int64 playerId = 0; // Request Hive SDK profile AuthV4.showProfile(playerId, onAuthV4ShowProfile); |
API Reference: AuthV4::showProfile
1 |
API Reference: com.hive.AuthV4.showProfile
1 2 3 4 5 6 7 8 9 |
// PlayerId that you want to check (This is checking my profile) long playerId = AuthV4.getPlayerInfo().playerId; AuthV4.showProfile(playerId, new AuthV4.AuthV4ShowProfileListener() { @Override public void onAuthV4ShowProfile(ResultAPI result) { } }); |
API Reference: HIVEAuthV4::showProfile
1 2 3 4 5 6 7 8 9 10 11 12 13 |
int64_t playerId = 0; // Request Hive SDK profile [HIVEAuthV4 showProfile:playerId handler:^(HIVEResultAPI *result) { Loggerd(@"HIVEAuthV4.showProfile:\nresult = %@", result); if (result.isSuccess) { } else { } }]; |
Inquiry
As a customer service system for Hive Platform users, it provides FAQ and inquiry for each games. This function is available on games, Hive website as well as Hive mobile web. Expose CS Code (PlayerID) with a button to access Hive Customer Service, which helps users post questions about games.
To expose the inquiry page, call showInquiry()
method in the AuthV4 class.
Followings are sample codes to display the inquiry page.
API Reference: hive.AuthV4.showInquiry
1 2 3 4 5 6 7 8 9 |
// Inquiry of Hive SDK // using hive // Hive SDK result callback handler public void onAuthV4ShowInquiry(ResultAPI result) { } // Request Hive SDK inquiry webview AuthV4.showInquiry(onAuthV4ShowInquiry); |
API Reference: AuthV4::showInquiry
1 |
API Reference: com.hive.AuthV4.showInquiry
1 2 3 4 5 |
AuthV4.showInquiry(new AuthV4.AuthV4ShowInquiryListener() { @Override public void onAuthV4ShowInquiry(ResultAPI result) { } }); |
API Reference: HIVEAuthV4::showInquiry
1 2 3 4 5 6 7 8 9 10 11 12 |
// Request inquiry webview of Hive SDK 1:1 [HIVEAuthV4 showInquiry:^(HIVEResultAPI *result) { Loggerd(@"HIVEAuthV4.showInquiry:\nresult = %@", result); if (result.isSuccess) { } else { } }]; |
My Inquiry Shortcut
The users synced with Hive membership can check their inquiry history via My Inquiry shortcut. Call showMyInquiry()
method in AuthV4 class to make users inquire about your game and solve it easily. If user has inquired via Hive mobile or website, however, the inquiries are not exposed even Hive ID and CS Code(PlayerID) are specified on it, because it’s unknown whether user logged-in Hive membership or not.
Followings are sample codes to expose My Inquiry shortcut.
API Reference: hive.AuthV4.showMyInquiry
1 2 3 4 5 6 7 8 |
// Hive SDK result callback handler public void onAuthV4ShowMyInquiry(ResultAPI result) { if(result.isSuccess()) { // Success in API call. } } // Request Hive SDK MyInquiry hive.AuthV4.showMyInquiry(onAuthV4ShowMyInquiry); |
API Reference: AuthV4::showMyInquiry
1 2 3 4 5 6 7 8 9 10 |
// Request Hive SDK MyInquiry AuthV4::showMyInquiry([=](ResultAPI result) { // Hive SDK result callback handler if(result.isSuccess()){ // Success in API call. } }); |
API Reference: com.hive.AuthV4.showMyInquiry
1 2 3 4 5 6 7 8 |
AuthV4.showMyInquiry(new AuthV4.AuthV4ShowMyInquiryListener() { @Override public void onAuthV4ShowMyInquiry(ResultAPI result) { if(result.isSuccess) { // Success in API call. } } }); |
API Reference: HIVEAuthV4::showMyInquiry
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[HIVEAuthV4 showMyInquiry:^(HIVEResultAPI *result) { Loggerd(@"HIVEAuthV4.showMyInquiry:\nresult = %@", result); if (result.isSuccess) { } else { } }]; |
Hive Chatbot CS
Inquiry via Chatbot
To expose the chatbot page, call showChatbotInquiry()
method in the AuthV4 class.
Argument | Type | Description |
---|---|---|
additionalInfo | string | Data to send when exposing chatbot page Fixed as "{ \"init_path\":\"hive_sdk_api\" }" and if additional values are required, contact Leading Development Team, Com2uS Platform |
Followings are sample codes to display the inquiry via chatbot page.
API Reference: hive.AuthV4.showChatbotInquiry
1 2 3 4 5 6 7 |
// The JSON-format data with String type to send when calling chatbot API String additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }"; AuthV4.showChatbotInquiry(additionalInfo, (ResultAPI result)=>{ if (result.isSuccess()) { // Success in API call } }); |
API Reference: AuthV4::showChatbotInquiry
1 2 3 4 5 6 7 |
// The JSON-format data with String type to send when calling chatbot API std::string additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }"; AuthV4::showChatbotInquiry(additionalInfo, [=](ResultAPI const &result){ if (result.isSuccess()) { // Success in API call } }); |
API Reference: com.hive.AuthV4.showChatbotInquiry
1 2 3 4 5 6 7 8 9 10 |
// The JSON-format data with String type to send when calling chatbot API String additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }"; AuthV4.showChatbotInquiry(additionalInfo, new AuthV4.AuthV4ShowChatbotInquiryListener() { @Override public void onAuthV4ShowChatbotInquiry(ResultAPI result) { if(result.isSuccess()){ // Success in API call } } }); |
API Reference: HIVEAuthV4::showChatbotInquiry
1 2 3 4 5 6 7 |
// The JSON-format data with String type to send when calling chatbot API NSString* additionalInfo = @"{ \"init_path\":\"hive_sdk_api\" }"; // [HIVEAuthV4 showChatbotInquiry:additionalInfo handler:^(HIVEResultAPI *result) { if ([result isSuccess]) { // Success in API call } }]; |
Chatbot Settings
AppDelegate in chatbot defines common actions (methods) of the object at the top in iOS app. When building your project with Xcode, it generates the class automatically.
Hive SDK exposes chatbot UI in portrait only for user convenience. Running this feature on iOS requires screen-orientation-related function, application(_:supportedInterfaceOrientationsFor:)
method in the AppDelegate class of the game engine. This method returns UIInterfaceOrientationMask value for using on the game. It returns landscape in landscape-only game, portrait in portrait-only game, and landscape as well as portrait in all-type-supported game.
1 2 3 4 5 6 7 8 9 10 |
// Implement the following AppDelegate function if your game engine is in Objective-c. - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { // TODO: For landscape only return UIInterfaceOrientationMaskLandscape; // TODO: For portrait only return UIInterfaceOrientationMaskPortrait; // TODO: For both landscape and portrait return UIInterfaceOrientationMaskAll; } |
1 2 3 4 5 6 7 8 9 10 |
// Implement the following AppDelegate function if your game engine is in Swift. func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { // TODO: For landscape only return [.landscape] // TODO: For portrait only return [.portrait] // TODO: For both landscape and portrait return .all } |
Chatbot only in portrait on iPad is required to build your Xcode project with the additional settings below.
Showing Community Page
For the automatic login and other functions in the Hive community, expose the community page through the API call as below.
1 2 3 4 5 6 7 8 9 10 11 12 |
// Set the view type (FullScreen: full screen, Frame: frame screen) SocialV4.ViewType viewType = SocialV4.ViewType.Frame; // showCommunity callback handler public void onShowCommunityResultAPI result) { if (result.isSuccess)) { // API Call Success } } // call showCommunity SocialV4.showCommunitySocialV4.ProviderType.HIVE, viewType, onShowCommunity);[/av_tab][av_tab title="Cocos2d-x"] |
1 2 3 4 5 6 7 8 9 |
// Set the view type (FullScreen: full screen, Frame: frame screen) SocialV4::ViewType viewType = SocialV4::ViewType::Frame; // call showCommunity SocialV4::showCommunitySocialV4::ProviderType::HIVE, viewType, [=]ResultAPI const & result) { ifresult.isSuccess) { // API Call Success }) }); |
1 2 3 4 5 6 7 8 9 10 11 12 |
// Set the view type (FullScreen: full screen, Frame: frame screen) SocialV4.ViewType viewType = SocialV4.ViewType.Frame; // call showCommunity com.hive.SocialV4.showCommunitySocialV4.ProviderType.HIVE, viewType, new com.hive.SocialV4.SocialV4ShowCommunityListener) { @Override public void onShowCommunity@NotNull ResultAPI result) { ifresult.isSuccess)) { // API Call Success } } }); |
1 2 3 4 5 6 7 8 9 |
// Set the view type (FullScreen: full screen, Frame: frame screen) HIVESocialViewType viewType = HIVESocialViewTypeFrame; // call showCommunity [HIVESocialV4 showCommunity:HIVESocialProviderTypeHIVE viewType:viewType handler:^HIVEResultAPI * result) { ifresult.isSuccess) { // API Call Success } }]; |
Implementing Remote Logging
Remote logging is a feature that allows you to check logs for debugging published apps remotely by sending debugging logs from client to Hive server. To implement this function, register on Hive Console. This feature activates the remote log of target users only. For more details how to register, refer to the operation guide in Operation > Provisioning > Remote logging.
- Activation
If you activate the remote logging, Hive log and game log are collected for the period of time you set on Hive Console. Hive log is based on the settings on SDK, and game log is flexible for game developers to set the value.
- Targeting
Remote logging targets only the users whose device has an ID (DID) through Hive SDK initialization once at least. This function, however, is unavailable to some games if crashes or errors occur before initializing SDK. -
Sample code
Insert the following code at every part where game requires to collect logs.
Unity®1hive.Logger.log("Input the contents of logging");C++1Logger::log("Input the contents of logging");Android1Logger.log(Logger.HIVELogType.HIVELogTypeI, "GameLog", "Input the contents of logging");iOS1Logger("Input the contents of logging");
Remote Configuration
Hive enables games to manage game server URL that mapped 1-to-1 with each version of the app. Remote configuration is given in the form of a string by calling getMetaData()
API of Configuration class. The following is an example code that calls the remote configuration.
API Reference: hive.Configuration.getMetaData
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Data key String key = "game_server_url"; // Whether to renew data Boolean forceReload = false; // Callback handler managing the result of calling matadata public void onGetMetaData(ResultAPI result, String value) { if (result.isSuccess()) { // Success in API call. } } // Call metadata Configuration.getMetaData(key, forceReload, onGetMetaData); |
API Reference: Configuration::gertMetaData
1 2 3 4 5 6 7 8 9 10 11 12 13 |
// Data key std::string key = "game_server_url"; // Whether to renew data bool forceReload = false; // Call metadata hive::Configuration::getMetaData(metaData,isNetwork,[=](hive::ResultAPI const & result,std::string value) { if (result.isSuccess()) { // Success in API call. } }); |
API Reference: com.hive.Configuration.getMetaData
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Data key String key = "game_server_url"; // Whether to renew data Boolean forceReload = false; // Call metadata Configuration.getMetaData(key, forceReload, new Configuration.GetMetaDataListener() { @Override public void onGetMetaData(ResultAPI result, String data) { if (result.isSuccess()) { // Success in API call. } } }); |
API Reference: HIVEConfiguration:getMetaData
1 2 3 4 5 6 7 8 9 10 11 12 |
let key = "game_server_url" // Whether to renew data let forceReload = false; // Call metadata ConfigurationInterface.getMetaData(testKey, forceReload: false) { result, value in if result.isSuccess() { // Success in API call. // If it returns false or null, the value is empty(""). } } |