Skip to content

How to initialize Hive SDK

To use Hive SDK 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.

Warning

Don’t forget to set hive_config.xml file before initializing Hive SDK.

How 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
  • Hive SDK does not directly notify app access permissions. For more information, please check [FAQ].
  • Expose the update and notice popups set for the relevant game. For the Google Play store, the in-app update is supported. For more details of registering update popups, see Hive Console guide.
  • Check the user IP and expose Terms of Service by country.

In-app update

The in-app update is the feature that following the update popup configuration updates the app on the background without terminating the app. The in-app update can be used under the following conditions.

  • Only the Google Play Store is supported.
  • Supports only Android mobile, Android tablet, and ChromeOS devices.
  • Supports both app file formats: AAB (Android App Bundle) and APK. However, APK expansion files (.obb files) are not supported.
  • For AAB, up to 200MB is supported, and For APK, up to 150MB is supported in size.

Hive initialization diagram

Register Hive authentication 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: Unity®

using hive;    
    String hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc";    
Configuration.setHiveCertificationKey(hiveCertKey);
include "HiveConfiguration.h"

    FString hiveCertKey = TEXT("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc");
    FHiveConfiguration::SetHiveCertificationKey(hiveCertKey);

API Reference: C++

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    string hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc";    
Configuration::setHiveCertificationKey(hiveCertKey);

API Reference: Kotlin

import com.hive.Configuration    
    val hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"    
Configuration.hiveCertificationKey = hiveCertKey

API Reference: Java

import com.hive.Configuration;    
    String hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc";    
Configuration.INSTANCE.setHiveCertificationKey(hiveCertkey);

API Reference: Swift

import HIVEService    
    let hiveCertKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc"    
ConfigurationInterface.setHiveCertificationKey(hiveCertKey)

API Reference: Objective-C

#import <HIVEService/HIVEService-Swift.h>    
    NSString *hiveCertKey = @"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIaXZlIiwiaWF0IjoxNjAzNzc4OTU2LCJqdGkiOiIxODczMTExMzIwIn0.OxWo4R6UdI0BLP1ckt8RlMFrPAb5H7TNedmLFV1Cawc";    
[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 The did is the identifier of an app instance that is created in the app installation. It is used to identify an app instance of the same app. 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: AuthV4::setup

// 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 } 
            });
#include "HiveAuthV4.h"

    FHiveAuthV4::Setup(FHiveAuthV4OnSetupDelegate::CreateLambda([this](const FHiveResultAPI& Result,
    bool IsAutoSignIn,
    const FString& Did,
    const TArray<EHiveProviderType>& ProviderTypeArray) 
    {
            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);
                    // initialization failed } 
            }
    }));

API Reference: com.hive.AuthV4.setup

// 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

// 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

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

// 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 } }];
Note

When the game service was terminated, an error will be returned if the setup method is executed.

Server naintenance 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
Note
  • Update/Maintenance popup is a part of initialization step. Server maintenance popup should be also exposed in the step of server selection, regardless of automatic or manual selection, so make sure to implement the maintenance popup to be displayed requisitely.

  • If a user can wait without starting the game before connecting to the game server, you cannot block the user's connection at this time even if you have already set the server maintenance pop-up. For this, a server maintenance pop-up should be displayed at the time where the game can forcibly terminate a user's connection.

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.

Setup 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.

Show popup

Hive SDK 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 as true.
  • A request for popup data to customize popups: Set isShow parameter as false. For more information about popup data, see Popup Data Returned by Hive below.

  • Example screen of popup

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: Unity®

using hive;    
    // Whether to use Hive SDK UI    
    Boolean isShow = true;    

    AuthV4.checkMaintenance(isShow, (ResultAPI result, List maintenanceInfoList) => {    
        if (result.isSuccess()) {    
            // If there is no inspection data    
            // If isShow is false    
        }    
        else if (result.needExit()) {    
            // TODO: Implement app termination functionality    
            // Example) Application.Quit();    
        }    
});
#include "HiveAuthV4.h"

// Whether to use Hive SDK UI  
bool bIsShow = true;

FHiveAuthV4::CheckMaintenance(bIsShow, FHiveAuthV4OnMaintenanceInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveAuthV4MaintenanceInfo>& AuthV4MaintenanceInfoArray) {

        if (Result.IsSuccess()) {
                // If there is no inspection data    
      // If isShow is false
        } else if (Result.NeedExit()) {
                // TODO: Implement app termination functionality    
      // Example) Application.Quit(); 
        }

}));

API Reference: C++

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // Whether to use Hive SDK UI    
    bool isShow = true;    

    AuthV4::checkMaintenance(isShow, [=](ResultAPI const & result, vector const & maintenanceInfolist){    
        if (result.isSuccess()) {    
            // If there is no registered inspection data    
            // If isShow is false    
        }    
        else if (reuslt.needExit()) {    
            // TODO: Implement app termination functionality    
            // Cocos2d-x engine user    
            // Example) exit(0);    
            // Unreal Engine User    
            // Example) UKismetSystemLibrary::QuitGame(GetWorld(), nullptr, EQuitPreference::Quit, false);    
        }    
});

API Reference: Kotlin

import com.hive.AuthV4    
import com.hive.AuthV4    
    import com.hive.ResultAPI    
    // Whether to use Hive SDK UI    
    val isShow = true    
    AuthV4.checkMaintenance(isShow, object : AuthV4.AuthV4MaintenanceListener {    
        override fun onAuthV4Maintenance(result: ResultAPI, maintenanceInfo: ArrayList<AuthV4.AuthV4MaintenanceInfo>?) {    
            if (result.isSuccess) {    
                // If there is no registered inspection data    
                // If isShow is false    
            }    
            else if (result.needExit()) {    
                // TODO: Implement app termination functionality    
                // Example) exitProcess(0)    
            }    
        }    
})

API Reference: Java

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    // Whether to use Hive SDK UI    
    boolean isShow = true;    
    AuthV4.INSTANCE.checkMaintenance(isShow, (result, maintenanceInfo) -> {    
        if (result.isSuccess()) {    
            // If there is no registered inspection data    
            // If isShow is false    
        }    
        else if (result.needExit()) {    
            // TODO: Implement app termination functionality    
            // Example) System.exit(0);    
        }    
});

API Reference: Swift

import HIVEService    
    // Whether to use Hive SDK UI    
    let isShow = true    

    AuthV4Interface.checkMaintenance(isShow) { result, maintenances in    
        if result.isSuccess() {    
            // If there is no actual inspection data    
            // If isShow is false    
        }    
        else if result.needExit() {    
            // TODO: Implement app termination functionality    
            // Example) exit(0)    
        }    
}

API Reference: Objective-C

#import <HIVEService/HIVEService-Swift.h>    
    // Whether to use Hive SDK UI    
    BOOL isShow = YES;    

    [HIVEAuthV4 checkMaintenance:isShow handler: ^(HIVEResultAPI *result, NSArray<HIVEAuthV4MaintenanceInfo *> *maintenanceInfolist) {    
        if (result.isSuccess) {    
            // If there is no registered inspection data    
            // If isShow is false    
        }    
        else if (result.needExit) {    
            // TODO: Implement app termination functionality    
            // Example) exit(0);    
        }    
}];
Note

At the time of checking the server maintenance pop-up and the time of clicking View Details button, iOS and Android deliver a callback requesting that the app should be closed by the game side. Please terminate the app when you receive the callback requesting the app termination. When a user clicks the close (X) button, only the popup is closed and the callback requesting the app termination is not delivered.

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_URL String
remainingTime Remaining time until maintenance completion (Unit: second). Time refreshes in real time and when it becomes zero, app is terminated. Integer
startDate the start date of the maintenance String
endDate the end date of the maintenance String
customerButton the button text of the customer center (the maintenance popup sends "") String
customerLink the button link of the customer center (the maintenance popup sends "") String
exButtons the popup button information (3 items are delivered at maximum) JSONArray
exButtons.action the action when the popup button was clicked
+ OPEN_URL: Execute URL passed by external browser
+ EXIT: End the app
+ DONE: Just close maintenance popup
Enumeration type of AuthV4MaintenanceActionType
exButtons.button the label text of the popup button String
exButtons.url the URL passed to the external browser.
action
available only if the field value is OPEN_URL
String

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.

  • Example screen of terms

To display Terms of Service when click the button or link, call showTerms() method of AuthV4 class. Followings are sample codes.

API Reference: Unity®

using hive;    
    AuthV4.showTerms((ResultAPI result) => {    
        if (result.isSuccess()) {    
            // API call success    
        }    
});
#include "HiveAuthV4.h"

FHiveAuthV4::ShowTerms(FHiveAuthV4OnShowTermsDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
        if (Result.IsSuccess()) {
                //API call success
        }
}));

API Reference: C++

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    AuthV4::showTerms([=](ResultAPI const & result) {    
        if (result.isSuccess()) {    
            // API call success    
        }    
});

API Reference: Kotlin

import com.hive.AuthV4    
    import com.hive.ResultAPI    
    AuthV4.showTerms(object : AuthV4.AuthV4ShowTermsListener {    
        override fun onAuthV4ShowTerms(result: ResultAPI) {    
            if (result.isSuccess) {    
                // API call success    
            }    
        }    
})

API Reference: Java

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    AuthV4.INSTANCE.showTerms(result -> {    
        if (result.isSuccess()) {    
            // API call success    
        }    
});

API Reference: Swift

import HIVEService    
    AuthV4Interface.showTerms() { result in    
        if result.isSuccess() {    
            // API call success    
        }    
}

API Reference: Objective-C

#import <HIVEService/HIVEService-Swift.h>    
    [HIVEAuthV4 showTerms:^(HIVEResultAPI *result) {     
        if ([result isSuccess]) {    
            // API call success    
        }    
}];

Remove the agreement history of terms & conditions

Once a game user agrees to the terms and conditions when running the game for the first time, the record of agreement to the terms and conditions remains on the device. The resetAgreement method below deletes this history.

Note

As of Hive SDK 4.22.0, when a game user deletes an account and then runs the game again, there is an issue that the terms and conditions agreement pop-up does not appear because the information about agreeing to the terms and conditions remains with the deleted account. If you want to re-display the terms and conditions agreement pop-up when resetting the Hive SDK after deleting your account, you must call resetAgreement to delete previously saved terms and conditions agreement information. Afterwards, call AuthV4.setup() to initialize the Hive SDK.

using hive;

AuthV4.resetAgreement();
#include "HiveAuthV4.h"

FHiveAuthV4::ResetAgreement();
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

AuthV4::resetAgreement()
import com.hive.AuthV4

AuthV4.resetAgreement()
import com.hive.AuthV4;

AuthV4.INSTANCE.resetAgreement();
import HIVEService

AuthV4Interface.resetAgreement()
#import <HIVEService/HIVEService-Swift.h>

[AuthV4Interface resetAgreement]

Hive profile

To display the profile screen, call showProfile() of the AuthV4 class. When the profile screen is displayed, users can check and change their profile image and nickname.

 

Below is an example code for displaying the profile.

API Reference: AuthV4.showProfile

using hive;    
    // playerId of the logged-in user    
    Int64 playerId = 12345;    
    AuthV4.showProfile(playerId, (ResultAPI result) => {    
        if (result.isSuccess()) {    
            // Call successful    
        }    
});
#include "HiveAuthV4.h"

// playerId of the logged-in user  
int64 PlayerId = 12345;

FHiveAuthV4::ShowProfile(PlayerId, FHiveAuthV4OnShowProfileDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
        if (Result.IsSuccess()) {
                // Call successful 
        }
}));

API Reference: AuthV4::showProfile

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // playerId of the logged-in user    
    long long playerId = 12345;    
    AuthV4::showProfile(playerId, [=](ResultAPI const & result){    
        if (result.isSuccess()) {    
            // Call successful    
        }    
});

API Reference: AuthV4.showProfile

import com.hive.AuthV4    
    import com.hive.ResultAPI    
    // playerId of the logged-in user    
    val playerId = 12345L    
    AuthV4.showProfile(playerId, object : AuthV4.AuthV4ShowProfileListener{    
        override fun onAuthV4ShowProfile(result: ResultAPI) {    
            if (result.isSuccess) {    
                // Call successful    
            }    
        }    
})

API Reference: AuthV4.INSTANCE.showProfile

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    // playerId of the logged-in user    
    long playerId = 12345;    
    AuthV4.INSTANCE.showProfile(playerId, result -> {    
        if (result.isSuccess()) {    
            // Call successful    
        }    
});

API Reference: AuthV4Interface.showProfile

import HIVEService    
    // playerId of the logged-in user    
    let playerId: Int64 = 12345    
    AuthV4Interface.showProfile(playerId) { result in    
        if result.isSuccess() {    
            // Call successful    
        }    
}

API Reference: [HIVEAuthV4 showProfile]

#import <HIVEService/HIVEService-Swift.h>    
    // playerId of the logged-in user    
    long long playerId = 12345;    
    [HIVEAuthV4 showProfile: playerId handler: ^(HIVEResultAPI *result) {    
        if ([result isSuccess]) {    
            // Call successful    
        }    
}];

If you provide Membership IdP, Hive Membership offers password change and membership withdrawal in Hive Account Settings on the Hive profile screen, so you must implement showProfile().

  • Profile when Hive Membership IdP was integrated.

  • Profile when the IdPs (including guest) other than Hive Membership were integrated.

Even if you provide other IdPs only and not Hive Membership IdP, displaying the profile screen allows you to offer security features such as blocking foreign logins, logging out of all devices, and checking login history. Therefore, it's recommended to implement showProfile() to display the profile screen. If integrated with IdPs like Facebook that return profile images and nicknames, the provided image and nickname from that IdP will automatically be set for the profile screen.

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.

Note
  • Hive Customer Service is available for guest users as well.
  • The regulations how to indicate the customer service link are diverse by game publishing company.
  • Displaying Email or phone number is prohibited due to policy issues except 1:1 inquiry.
  • An example screen of Inquiry

To expose the inquiry page, call showInquiry() method in the AuthV4 class. Followings are sample codes to display the inquiry page.

API Reference: AuthV4.showInquiry

using hive;    
    AuthV4.showInquiry((ResultAPI result) => {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});
#include "HiveAuthV4.h"

FHiveAuthV4::ShowInquiry(FHiveAuthV4OnShowInquiryDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
        if (Result.IsSuccess()) {
                // call successful 
        }
}));

API Reference: AuthV4 ::showInquiry

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    AuthV4::showInquiry([=](ResultAPI const & result) {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});

API Reference: AuthV4.showInquiry

import com.hive.AuthV4    
    import com.hive.ResultAPI    
    AuthV4.showInquiry(object : AuthV4.AuthV4ShowInquiryListener {    
         override fun onAuthV4ShowInquiry(result: ResultAPI) {    
             if (result.isSuccess) {    
                 // call successful    
             }    
         }    
})

API Reference: AuthV4.INSTANCE.showInquiry

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    AuthV4.INSTANCE.showInquiry(result -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: AuthV4Interface .showInquiry

import HIVEService    
    AuthV4Interface.showInquiry() { result in    
    if result.isSuccess() {    
    // call successful    
    }    
}

API Reference: [ HIVEAuthV4 showInquiry]

#import <HIVEService/HIVEService-Swift.h>    
    [HIVEAuthV4 showInquiry: ^(HIVEResultAPI *result) {    
    if ([result isSuccess]) {    
    // call successful    
    }    
}];

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.

Note
  • You can implement the My Inquiry shortcut API when user logged-in Hive membership only. If you try to call the API in synced with anothe IdP, an error message will br returned.
  • In Auth v4, it is required to link account with Hive membership to isseue UID. Therefore, My Inquiry shortcut is unable to implement in Auth v4 if user logs in as a guest or any other IdPs than Hive membership.

Followings are sample codes to expose My Inquiry shortcut.

API Reference: hive.AuthV4 .showMyInquiry

using hive;    
    AuthV4.showMyInquiry((ResultAPI result) => {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});
#include "HiveAuthV4.h"

FHiveAuthV4::ShowMyInquiry(FHiveAuthV4OnShowInquiryDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
        if (Result.IsSuccess()) {
                // call successful
        }
}));

API Reference: AuthV4:: showMyInquiry

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    AuthV4::showMyInquiry([=](ResultAPI const & result) {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});

API Reference: AuthV4.showMyInquiry

import com.hive.AuthV4    
    import com.hive.ResultAPI    
    AuthV4.showMyInquiry(object : AuthV4.AuthV4ShowMyInquiryListener {    
         override fun onAuthV4ShowMyInquiry(result: ResultAPI) {    
             if (result.isSuccess) {    
                 // call successful    
             }    
         }    
})

API Reference: com.hive .AuthV4.showMyInquiry

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    AuthV4.INSTANCE.showMyInquiry(result -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: AuthV4Interface .showMyInquiry

import HIVEService    
    AuthV4Interface.showMyInquiry() { result in    
    if result.isSuccess() {    
    // call successful    
    }    
}

API Reference: HIVEAuthV4:: showMyInquiry

#import <HIVEService/HIVEService-Swift.h>    
    [HIVEAuthV4 showMyInquiry: ^(HIVEResultAPI *result) {    
    if ([result isSuccess]) {    
    // call successful    
    }    
}];

Hive chatbot CS

Inquiry via chatbot
  • An example screen of inquiry for 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

using hive;    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    String additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }";    
    AuthV4.showChatbotInquiry(additionalInfo, (ResultAPI result) => {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});
#include "HiveAuthV4.h"

// String data in JSON format promised to be delivered when calling the chatbot page shortcut API
TSharedPtr<FJsonObject> AdditionalInfoJson = MakeShareable(new FJsonObject);
AdditionalInfoJson->SetStringField(TEXT("init_path"), TEXT("hive_sdk_api"));

FString StrAdditionalInfo;
TSharedRef<TJsonWriter<>> JsonWriter = TJsonWriterFactory<>::Create(&StrAdditionalInfo);
FJsonSerializer::Serialize(AdditionalInfoJson.ToSharedRef(), JsonWriter);

FHiveAuthV4::ShowChatbotInquiry(StrAdditionalInfo, FHiveAuthV4OnShowInquiryDelegate::CreateLambda([this](const FHiveResultAPI& Result) {
        if (Result.IsSuccess()) {
                // call successful 
        }
}));

API Reference: AuthV4 ::showChatbotInquiry

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    string additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }";    
    AuthV4::showChatbotInquiry(additionalInfo, [=](ResultAPI const &result) {    
         if (result.isSuccess()) {    
            // call successful    
         }    
});

API Reference: AuthV4.showChatbotInquiry

import com.hive.AuthV4    
    import com.hive.ResultAPI    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    val additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }"    
    AuthV4.showChatbotInquiry(additionalInfo, object : AuthV4.AuthV4ShowChatbotInquiryListener {    
         override fun onAuthV4ShowChatbotInquiry(result: ResultAPI) {    
             if (result.isSuccess) {    
                 // call successful    
             }    
         }    
})

API Reference: com.hive .AuthV4.showChatbotInquiry

import com.hive.AuthV4;    
    import com.hive.ResultAPI;    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    String additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }";    
    AuthV4.INSTANCE.showChatbotInquiry(additionalInfo, result -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: AuthV4Interface.showChatbotInquiry

import HIVEService    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    let additionalInfo = "{ \"init_path\":\"hive_sdk_api\" }"    
    AuthV4Interface.showChatbotInquiry(additionalInfo) { result in    
    if result.isSuccess() {    
    // call successful    
    }    
}

API Reference: HIVEAuthV4:: showChatbotInquiry

#import <HIVEService/HIVEService-Swift.h>    
    // String data in JSON format promised to be delivered when calling the chatbot page shortcut API    
    NSString *additionalInfo = @"{ \"init_path\":\"hive_sdk_api\" }";    
    [HIVEAuthV4 showChatbotInquiry:additionalInfo handler:^(HIVEResultAPI *result) {    
    if ([result isSuccess]) {    
             // call successful    
         }    
}];

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.

Warning

Unity engine already includes AppDelegate method for screen rotation, so it is automatically run if you build your project in Xcode. That is, do not add the following sample code to your game if you develop your game in Unity.

Note

Chatbot service is available after you request Solution Architech part, Com2uS Platform for AppID registration process.

// 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;
}
// 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.

Exposure to the community

For the automatic login processing and the normal operation of the community, expose the community site through the API call as shown below. When setting up Community sites that follow the Hive regulations, if you want to use a custom domain address other than withhive.com and com2us.com, register the domain address to Hive Console whitelist and then call this API.

For the automatic login and other functions in the Hive community, expose the community page through the API call as below.

Note

In the Windows environment, if a community page to be exposed is opened as a frame, the page cannot be rendered if the X-Frame-Options header is set on the page due to security issues. Check the options of the page you want to open in frame form.

API Reference: SocialV4 .showCommunity

using hive;    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    SocialV4.ViewType viewType = SocialV4.ViewType.Frame;    
    SocialV4.showCommunity(SocialV4.ProviderType.HIVE, viewType, (ResultAPI result) => {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});
#include "HiveSocialV4.h"

// Set view type (FullScreen: full screen, Frame: frame screen)
ESocialV4ViewType ViewType = ESocialV4ViewType::Frame;

FHiveSocialV4::ShowCommunity(ESocialV4ProviderType::HIVE, ViewType, FHiveSocialV4OnShowCommunityDelegate::CreateLambda([this](const FHiveResultAPI& Result) {

        if (Result.IsSuccess()) {
                // call successful
        }
}));

API Reference: SocialV4 .showCommunity

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    SocialV4::ViewType viewType = SocialV4::ViewType::Frame;    
    SocialV4.showCommunity(SocialV4::ProviderType::HIVE, viewType, (ResultAPI const & result) {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});

API Reference: SocialV4.showCommunity

import com.hive.SocialV4    
    import com.hive.ResultAPI    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    val viewType = SocialV4.ViewType.Frame    
    SocialV4.showCommunity(SocialV4.ProviderType.HIVE, viewType, object : SocialV4.SocialV4ShowCommunityListener{    
         override fun onShowCommunity(result: ResultAPI) {    
             if (result.isSuccess) {    
                 // call successful    
             }    
         }    
})

API Reference: SocialV4.INSTANCE .showCommunity

import com.hive.SocialV4;    
    import com.hive.ResultAPI;    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    SocialV4.ViewType viewType = SocialV4.ViewType.Frame;    
    SocialV4.INSTANCE.showCommunity(SocialV4.ProviderType.HIVE, viewType, result -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: SocialV4Interface.showCommunity

import HIVEService    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    let viewType = SocialViewType.Frame    
    SocialV4Interface.showCommunity(.HIVE, viewType) { result in    
    if result.isSuccess() {    
    // call successful    
    }    
}

API Reference: HIVESocialV4 showCommunity

#import <HIVEService/HIVEService-Swift.h>    
    // Set view type (FullScreen: full screen, Frame: frame screen)    
    HIVESocialViewType viewType = HIVESocialViewTypeFrame;    
    [HIVESocialV4 showCommunity: HVIESocialProviderTypeHIVE viewType: viewType handler: ^(HIVEResultAPI *result) {    
    if ([result isSuccess]) {    
    // call successful    
    }    
}];

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 SDK log and game log are collected for the period of time you set on Hive Console. Hive SDK log is based on the settings on SDK, and game log is flexible for game developers to set the value.

    Warning

    Make sure that

    • if you generate too much logs, overloaded network traffic or log process may interfere with the running of your game. Hive recommends you to omit the repeating logs from loop type or gather as one log before delivery for implementing remote logging.

    • if you are going to use the remote logging on game log, please contact the PIC of Solution Architect part, GAMEVIL COM2US PLATFORM in advance.

  • 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.

  • How remote logging works

  • Sample code
    Insert the following code at every part where game requires to collect logs.

API Reference: Logger .log

using hive;    
Logger.log("Enter logging contents");
#include "HiveLogger.h"

FHiveLogger::Log(TEXT("Enter logging contents"));

API Reference: Logger:: log

  #include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
   Logger::log("Enter logging contents");

API Reference: Logger.i

import com.hive.Logger;    
Logger.INSTANCE.i("Enter logging contents");

API Reference: LogInterface.log

import HIVEBase    
LogInterface.log(sourceInfo: "Log source information (class, method name)", type: .Info, tag: "Log tag", msg: "Log message")

API Reference: Objective-C

#import <HIVEBase/HIVEBase-Swift.h>

[HIVELogger logWithSourceInfo:@"Log source information (class, method name)" type: LogTypeInfo tag: @"Log tag" msg: @"Log message"];

Remote configuration

Hive SDK 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: HiveConfiguration getMetaData

using hive;    
    // data key    
    String key = "game_server_url";    
    // Whether data is updated    
    Boolean forceReload = false;    
    // metadata call    
    Configuration.getMetaData(key, forceReload, (ResultAPI result, String value) => {    
    if (result.isSuccess()) {    
    // call successful    
    }    
});
#include "HiveConfiguration.h"

// data key
FString Key = TEXT("game_server_url");

// Whether data is updated
bool bForceReload = false;

// metadata call
FHiveConfiguration::GetMetaData(Key, bForceReload, FHiveConfigurationOnMetaDataDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FString& Value) {
        if (Result.IsSuccess()) {
                // call successfull
        }
}));

API Reference: Configuration:: getMetaData

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
    using namespace std;    
    using namespace hive;    
    // data key    
    string key = "game_server_url";    
    // Whether data is updated    
    bool forceReload = false;    

    // metadata call    
    Configuration::getMetaData(key, forceReload, [=](ResultAPI const & result, string value) {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: Configuration.getMetaData

import com.hive.Configuration    
    import com.hive.ResultAPI    
    // data key    
    val key = "game_server_url"    
    // Whether data is updated    
    val forceReload = false    
    // metadata call    
    Configuration.getMetaData(key, forceReload, object : Configuration.GetMetaDataListener {    
         override fun onGetMetaData(result: ResultAPI, data: String) {    
             if (result.isSuccess) {    
                 // call successful    
             }    
         }    
})

API Reference: Configuration.INSTANCE .getMetaData

import com.hive.Configuration;    
    import com.hive.ResultAPI;    
    // data key    
    String key = "game_server_url";    
    // Whether data is updated    
    boolean forceReload = false;    
    // metadata call    
    Configuration.INSTANCE.getMetaData(key, forceReload, (result, data) -> {    
         if (result.isSuccess()) {    
             // call successful    
         }    
});

API Reference: ConfigurationInterface.getMetaData

import HIVEService    
    // data key    
    let key = "game_server_url"    
    // Whether data is updated    
    let forceReload = false;    

    // metadata call    
    ConfigurationInterface.getMetaData(key, forceReload: forceReload) { result, value in    
         if result.isSuccess() {    
             // call successful    
         }    
}

API Reference: HIVEConfiguration getMegaData

#import <HIVEService/HIVEService-Swift.h>    
    // data key    
    NSString *key = @"game_server_url";    
    // Whether data is updated    
    BOOL forceload = NO;    
    // metadata call    
    [HIVEConfiguration getMegaData: key forceReload: forceReload handler: ^(HIVEResultAPI *result, NSString *value) {    
    if ([result isSuccess]) {    
    // call successful    
    }    
}];
Note

To use cached data, set forceReload as false.

  • If you call the getMetaDate() method when forceReload is true, it deletes locally stored data and tries to get the latest data from the server. This action is commonly used for tasks such as refreshing on re-running an app.