Advanced function provides custom section; Custom View that allows you to display HTML page you want, Custom Board that can display customized bulletin board, Spot Banner and Direct View that can display specific banner registered on Hive Console at desired point.
Custom View¶
Custom View is a function that exposes an external URL or input content to a web view with a separate button in the game. One and more custom views are available in a game so it can be used in various ways under diverse situations.
Registration¶
Hive Console provides an editor to create and compose custom view. You can register external links through Hive Console as the same way of setting the general custom view. For more information to create and register custom view, see Hive Console Promotion.
Creation¶
To display Custom View registered on Hive Console or for external page, call showCustomContents()
method of Promotion class as following explanation.
- Set customType as
PromotionCustomType.VIEW
parameter. - Set contentsKey parameter as the Custom View ID in Hive Console > Promotion > Campaign Settings > Custom View Tab > Management Name.
API Reference: hive.Promotion.showCustomContents
using hive;
PromotionCustomType customType = PromotionCustomType.VIEW;
String contentsKey = "12345";
Promotion.showCustomContents(customType, contentsKey, (ResultAPI result, PromotionEventType viewEventType) => {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
#include "HivePromotion.h"
EHivePromotionCustomType PromotionCustomType = EHivePromotionCustomType::VIEW;
FString ContentsKey = TEXT("12345");
FHivePromotion::ShowCustomContents(PromotionCustomType, ContentsKey, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (!Result.IsSuccess()) {
return;
}
// API 호출 성공
switch (PromotionEventType) {
case EHivePromotionEventType::OPEN:
// 프로모션 뷰 열림
break;
case EHivePromotionEventType::CLOSE:
// 프로모션 뷰 닫힘
break;
default:
// 기타 이벤트 발생
break;
}
}));
API Reference: Promotion::showCustomContents
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionCustomType customType = PromotionCustomType::VIEW;
string contentsKey = "12345";
Promotion::showCustomContents(customType, contentsKey, [=](ResultAPI result, PromotionEventType viewEventType) {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
API Reference: Promotion.showCustomContents
import com.hive.Promotion
import com.hive.ResultAPI
val promotionCustomType = Promotion.PromotionCustomType.VIEW
val contentsKey = "12345"
Promotion.showCustomContents(promotionCustomType, contentsKey, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (!result.isSuccess) {
return
}
// call successful
when (promotionEventType) {
Promotion.PromotionViewResultType.OPENED -> {
// Open promotion view
}
Promotion.PromotionViewResultType.CLOSED -> {
// Close promotion view
}
}
}
})
API Reference: Promotion.INSTANCE.showCustomContents
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionCustomType promotionCustomType = Promotion.PromotionCustomType.VIEW;
String contentsKey = "12345";
Promotion.INSTANCE.showCustomContents(promotionCustomType, contentsKey, (result, viewResultType) -> {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewResultType) {
case OPENED:
// Open promotion view
break;
case CLOSED:
// Close promotion view
break;
}
});
API Reference: PromotionInterface.showCustomContents
import HIVEService
let type = PromotionCustomType.view
let contentsKey = "12345"
PromotionInterface.showCustomContents(type, contents: contentsKey) { result, viewResultType in
if !result.isSuccess() {
return
}
// call successful
switch viewResultType {
case .open:
// Open promotion view
case .close:
// Close promotion view
}
}
API Reference: HivePromotion:showCustomContents
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionCustomType type = HIVEPromotionCustomTypeVIEW;
NSString *contentsKey = @"12345";
[HIVEPromotion showCustomContents: type contents: contentsKey handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if (![result isSuccess]) {
return;
}
// call successful
switch (viewResultType) {
case HIVEPromotionViewResultTypeOpen:
// Open promotion view
break;
case HIVEPromotionViewResultTypeClose:
// Close promotion view
break;
}
}];
Custom Board¶
Unlike general promotion notice, Custom Board is available to display a list of bulletin boards for various purposes within the game.
Registration¶
For more information to create and register the Custom Board, see Hive Console Promotion Guide.
Creation¶
To display a Custom Board, set the parameter as following explanation and then call showCustomContents()
method of Promotion class.
- Set customType as
PromotionCustomType.BOARD
parameter. - Set contentsKey parameter as Board Key in Hive Console > Promotion > Custom Board.
Followings are sample codes to display Custom Board.
API Reference: hive.Promotion.showCustomContents
using hive;
PromotionCustomType customType = PromotionCustomType.BOARD;
String contentsKey = "12345";
Promotion.showCustomContents(customType, contentsKey, (ResultAPI result, PromotionEventType viewEventType) => {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
#include "HivePromotion.h"
EHivePromotionCustomType PromotionCustomType = EHivePromotionCustomType::BOARD;
FString ContentsKey = TEXT("12345");
FHivePromotion::ShowCustomContents(PromotionCustomType, ContentsKey, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (!Result.IsSuccess()) {
return;
}
// API call successful
switch (PromotionEventType) {
case EHivePromotionEventType::OPEN:
// Open promotion view
break;
case EHivePromotionEventType::CLOSE:
// Close promotion view
break;
default:
// 기타 이벤트 발생
break;
}
}));
API Reference: Promotion::showCustomContents
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionCustomType customType = PromotionCustomType::BOARD;
string contentsKey = "12345";
Promotion::showCustomContents(customType, contentsKey, [=](ResultAPI result, PromotionEventType viewEventType) {
if (!result.isSuccess()) {
return;
}
// call successfull
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
API Reference: Promotion.showCustomContents
import com.hive.Promotion
import com.hive.ResultAPI
val promotionCustomType = Promotion.PromotionCustomType.BOARD
val contentsKey = "12345"
Promotion.showCustomContents(promotionCustomType, contentsKey, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (!result.isSuccess) {
return
}
// call successful
when (promotionEventType) {
Promotion.PromotionViewResultType.OPENED -> {
// Open promotion view
}
Promotion.PromotionViewResultType.CLOSED -> {
// Close promotion view
}
}
}
})
API Reference: com.hive.Promotion.showCustomContents
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionCustomType promotionCustomType = Promotion.PromotionCustomType.BOARD;
String content_key = "12345";
Promotion.INSTANCE.showCustomContents(promotionCustomType, content_key, (result, viewResultType) -> {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewResultType) {
case OPENED:
// Open promotion view
break;
case CLOSED:
// Close promotion view
break;
}
});
API Reference: PromotionInterface.showCustomContents
import HIVEService
let type = PromotionCustomType.board
let contentsKey = "12345"
PromotionInterface.showCustomContents(type, contents: contentsKey) { result, viewResultType in
if !result.isSuccess() {
return
}
// call successful
switch viewResultType {
case .open:
// Open promotion view
case .close:
// Close promotion view
}
}
API Reference: HivePromotion:showCustomContents
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionCustomType type = HIVEPromotionCustomTypeBOARD;
NSString *contentsKey = @"12345";
[HIVEPromotion showCustomContents: type contents: contentsKey handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if (![result isSuccess]) {
return;
}
// call successful
switch (viewResultType) {
case HIVEPromotionViewResultTypeOpen:
// Open promotion view
break;
case HIVEPromotionViewResultTypeClose:
// Close promotion view
break;
}
}];
Spot Banner¶
Spot Banner allows you to expose interstitial banners at a desired location or timing in the game. You can register the spot banners on Hive Console > Promotion > Campaign Settings > Spot Banner.
To display Spot Banner, set the parameter as following explanation and then call showCustomContents()
method of Promotion class.
- Set customType as
PromotionCustomType.SPOT
parameter. - Set contentsKey parameter as the Spot Banner ID in Hive Console > Promotion > Campaign Settings > Spot Banner Tab > Management Name. This feature is available on the games with SDK v4.
Followings are sample codes to create Spot Banner.
API Reference: hive.Promotion.showCustomContents
using hive;
PromotionCustomType customType = PromotionCustomType.SPOT;
String contentsKey = "12345";
Promotion.showCustomContents(customType, contentsKey, (ResultAPI result, PromotionEventType viewEventType) => {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
#include "HivePromotion.h"
EHivePromotionCustomType PromotionCustomType = EHivePromotionCustomType::SPOT;
FString ContentsKey = TEXT("12345");
FHivePromotion::ShowCustomContents(PromotionCustomType, ContentsKey, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (!Result.IsSuccess()) {
return;
}
// API call success
switch (PromotionEventType) {
case EHivePromotionEventType::OPEN:
// Open promotion view
case EHivePromotionEventType::CLOSE:
// 프로모션 뷰 닫힘
break;
default:
// Close promotion view
break;
}
}));
API Reference: Promotion::showCustomContents
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionCustomType customType = PromotionCustomType::SPOT;
string contentsKey = "12345";
Promotion::showCustomContents(customType, contentsKey, [=](ResultAPI result, PromotionEventType viewEventType) {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
API Reference: Promotion.showCustomContents
import com.hive.Promotion
import com.hive.ResultAPI
val promotionCustomType = Promotion.PromotionCustomType.SPOT
val contentsKey = "12345"
Promotion.showCustomContents(promotionCustomType, contentsKey, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (!result.isSuccess) {
return
}
// call successful
when (promotionEventType) {
Promotion.PromotionViewResultType.OPENED -> {
// Open promotion view
}
Promotion.PromotionViewResultType.CLOSED -> {
// Close promotion view
}
}
}
})
API Reference: com.hive.Promotion.showCustomContents
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionCustomType promotionCustomType = Promotion.PromotionCustomType.SPOT;
String content_key = "12345";
Promotion.INSTANCE.showCustomContents(promotionCustomType, content_key, (result, viewResultType) -> {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewResultType) {
case OPENED:
// Open promotion view
break;
case CLOSED:
// Close promotion view
break;
}
});
API Reference: PromotionInterface.showCustomContents
import HIVEService
let type = PromotionCustomType.spot
let contentsKey = "12345"
PromotionInterface.showCustomContents(type, contents: contentsKey) { result, viewResultType in
if !result.isSuccess() {
return
}
// call successful
switch viewResultType {
case .open:
// Open promotion view
case .close:
// Close promotion view
}
}
API Reference: HivePromotion:showCustomContents
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionCustomType type = HIVEPromotionCustomTypeSPOT;
NSString *contentsKey = @"12345";
[HIVEPromotion showCustomContents: type contents: contentsKey handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if (![result isSuccess]) {
return;
}
// call successful
switch (viewResultType) {
case HIVEPromotionViewResultTypeOpen:
// Open promotion view
break;
case HIVEPromotionViewResultTypeClose:
// Close promotion view
break;
}
}];
[su_divider text="⇡ Go to top" divider_color="#65737e" link_color="#65737e" size="1"]
Direct View¶
Direct View is a function that invokes the campaign number registered on the Hive Console from the game and exposes directly. When you call the campaign ID registered in the Hive Console in the game, the corresponding contents is displayed as a frame or the full screen. From the Hive SDK 4.16.0, you can display in full screen or frame type depending on the exposure type set in Promotion > Campaign Settings in the Hive Console.
To display Direct View, set the parameter as following explanation and then call the showCustomContents()
method in the Promotion class.
- Set customType as
PromotionCustomType.DIRECT
parameter. Set contentsKey parameter as the Campaign number in Hive Console > Promotion > Campaign Settings > Normal Banner Tab*.
Followings are sample codes to create Direct View.
API Reference: hive.Promotion.showCustomContents
using hive;
PromotionCustomType customType = PromotionCustomType.DIRECT;
String contentsKey = "12345";
Promotion.showCustomContents(customType, contentsKey, (ResultAPI result, PromotionEventType viewEventType) => {
if (!result.isSuccess()) {
return;
}
// call success
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
#include "HivePromotion.h"
EHivePromotionCustomType PromotionCustomType = EHivePromotionCustomType::DIRECT;
FString ContentsKey = TEXT("12345");
FHivePromotion::ShowCustomContents(PromotionCustomType, ContentsKey, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (!Result.IsSuccess()) {
return;
}
// API call success
switch (PromotionEventType) {
case EHivePromotionEventType::OPEN:
// Open promotion view
break;
case EHivePromotionEventType::CLOSE:
// Close promotion view
break;
default:
// 기타 이벤트 발생
break;
}
}));
API Reference: Promotion::showCustomContents
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionCustomType customType = PromotionCustomType::DIRECT;
string contentsKey = "12345";
Promotion::showCustomContents(customType, contentsKey, [=](ResultAPI result, PromotionEventType viewEventType) {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
}
});
API Reference: Promotion.showCustomContents
import com.hive.Promotion
import com.hive.ResultAPI
val promotionCustomType = Promotion.PromotionCustomType.DIRECT
val contentsKey = "12345"
Promotion.showCustomContents(promotionCustomType, contentsKey, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (!result.isSuccess) {
return
}
// call successful
when (promotionEventType) {
Promotion.PromotionViewResultType.OPENED -> {
// Open promotion view
}
Promotion.PromotionViewResultType.CLOSED -> {
// Close promotion view
}
}
}
})
API Reference: com.hive.Promotion.showCustomContents
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionCustomType promotionCustomType = Promotion.PromotionCustomType.DIRECT;
String content_key = "12345";
Promotion.INSTANCE.showCustomContents(promotionCustomType, content_key, (result, viewResultType) -> {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewResultType) {
case OPENED:
// Open promotion view
break;
case CLOSED:
// Close promotion view
break;
}
});
API Reference: PromotionInterface.showCustomContents
import HIVEService
let type = PromotionCustomType.direct
let contentsKey = "12345"
PromotionInterface.showCustomContents(type, contents : contentsKey) {
result,
viewResultType in
if !result.isSuccess() {
return
}
// call successful
switch viewResultType {
case.open:
// Open promotion view
case.close:
// Close promotion view
}
}
API Reference: HivePromotion:showCustomContents
#import <HIVEService /HIVEService-Swift.h>
HIVEPromotionCustomType type = HIVEPromotionCustomTypeDIRECT;
NSString *contentsKey = @"12345";
[HIVEPromotion showCustomContents: type contents: contentsKey handler: ^(HIVEResultAPI *result,
HIVEPromotionViewResultType viewResultType) {
if (![result isSuccess]) {
return;
}
// call successful
switch (viewResultType) {
case HIVEPromotionViewResultTypeOpen:
// Open promotion view
break;
case HIVEPromotionViewResultTypeClose:
// Close promotion view
break;
}
}];
Implement your own Banner¶
The Hive SDK provides exposing the desired campaigns as banners via showPromotion
method. However, you may want to expose a banner (rolling banner) that is not provided by the Hive SDK, or you may want to customize and expose a banner provided by the Hive SDK as you wish. To implement your own banner, you need to follow the steps below.
- Register the information (the banner image, link, etc.) of the banner to be implemented and exposed in the Hive Console.
- Call Hive SDK's getBannerInfo() to get the information needed to implement the banner from the Hive Server.
- Based on the received information, implement the banner and expose it in the game.
Note
The Hive SDK provides the information needed to implement the banner allowing you customize all banners and directly expose them in the game.
Rolling Banner¶
A rolling banner is a banner whose content is flowing. To expose rolling banners, the game studio must implement and expose them by themselves.
Get Banner information¶
getBannerInfo
is a function that obtains the information needed to expose the banner in a desired standard when the game studio wants to directly implement the banner. When this API fetches the data for configuring the banner from the Hive Server, your game can use this data to display the banner however you want. To call this API, Authentication v1 or Authentication v4 must be initialized. If not initialized, the problems may occur in receiving data.
Note
You can convert the pid (Integer) value received when clicking the banner to the contentsKey (String), and pass it as an argument to Promotion class showCustomContents()
method to expose it as a direct view form.
API request example¶
API Reference: hive .Promotion.getBannerInfo
using hive;
/*
ALL,
EVENT,
NOTICE,
CROSS (Cross Banner)
*/
PromotionCampaignType campaignType = PromotionCampaignType.EVENT;
/*
SMALL (band banner),
GREAT (Great Banner),
ROLLING (rolling banner)
*/
PromotionBannerType bannerType = PromotionBannerType.ROLLING;
Promotion.getBannerInfo(campaignType, bannerType, (ResultAPI result, List bannerInfoList) => {
if (result.isSuccess()) {
// call successful
}
});
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
String campaignType = "event";
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
String bannerType = "rolling";
Promotion.getBannerInfoString(campaignType, bannerType, (ResultAPI result, List bannerInfoList) => {
if (result.isSuccess()) {
// call successful
}
});
```c++
include "HivePromotion.h"¶
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
EHivePromotionCampaignType CampaignType = EHivePromotionCampaignType::EVENT;
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
EHivePromotionBannerType BannerType = EHivePromotionBannerType::ROLLING;
FHivePromotion::GetBannerInfo(CampaignType, BannerType, FHivePromotionOnBannerInfoDelegate::CreateLambda(this { if (Result.IsSuccess()) { // call success } }));
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
/
FString CampaignType = TEXT("event"); /
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/ FString BannerType = TEXT("rolling");
FHivePromotion::GetBannerInfoString(CampaignType, BannerType, FHivePromotionOnBannerInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHivePromotionBannerInfo>& PromotionBannerInfoList) {
if (Result.IsSuccess()) {
// API call success
}
}));
```
API Reference: Promotion ::getBannerInfo
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
/*
ALL,
EVENT,
NOTICE,
CROSS (Cross Banner)
*/
PromotionCampaignType campaignType = PromotionCampaignType::EVENT;
/*
SMALL (band banner),
GREAT (Great Banner),
ROLLING (rolling banner)
*/
PromotionBannerType bannerType = PromotionBannerType::ROLLING;
Promotion::getBannerInfo(campaignType, bannerType, [=](ResultAPI result, vector bannerInfos) {
if (result.isSuccess()) {
// call successful
}
});
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
string campaignType = "event";
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
string bannerType = "rolling";
Promotion::getBannerInfoString(campaignType, bannerType, [=](ResultAPI result, vector bannerInfos) {
if (result.isSuccess()) {
// call successful
}
});
API Reference: Promotion.getBannerInfo
import com.hive.Promotion
import com.hive.ResultAPI
/*
ALL,
EVENT,
NOTICE,
CROSS (Cross Banner)
*/
val campaignType = Promotion.PromotionCampaignType.EVENT
/*
SMALL (band banner),
GREAT (Great Banner),
ROLLING (rolling banner)
*/
val bannerType = Promotion
.PromotionBannerType
.ROLLING
Promotion
.getBannerInfo(
campaignType,
bannerType,
object : Promotion.PromotionBannerInfoListener {
override fun onReceiveInfo(
result : ResultAPI,
bannerInfoList : ArrayList <Promotion.PromotionBanner>?
) {
if (result.isSuccess) {
// call successful
}
}
}
)
// Banner type and campaign type can also be called through strings instead of
// enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
val campaignType = "event"
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
val bannerType = "rolling"
Promotion.getBannerInfoString(
campaignType,
bannerType,
object : Promotion.PromotionBannerInfoListener {
override fun onReceiveInfo(
result : ResultAPI,
bannerInfoList : ArrayList <Promotion.PromotionBanner>?
) {
if (result.isSuccess) {
// call successful
}
}
}
)
API Reference: Promotion .INSTANCE.getBannerInfo
import com.hive.Promotion;
import com.hive.ResultAPI;
/*
ALL,
EVENT,
NOTICE,
CROSS (Cross Banner)
*/
Promotion.PromotionCampaignType campaignType = Promotion.PromotionCampaignType.EVENT;
/*
SMALL (band banner),
GREAT (Great Banner),
ROLLING (rolling banner)
*/
Promotion.PromotionBannerType bannerType = Promotion.PromotionBannerType.ROLLING;
Promotion.INSTANCE.getBannerInfo(campaignType, bannerType, (result, bannerInfoList) -> {
if(result.isSuccess()) {
// call successful
}
});
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
String campaignType = "event";
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
String bannerType = "rolling";
Promotion.INSTANCE.getBannerInfo(campaignType, bannerType, (result, bannerInfoList) -> {
if(result.isSuccess()) {
// call successful
}
});
API Reference: PromotionInterface.getBannerInfo
import HIVEService
/*
all (all),
event(event),
notice,
cross (cross banner)
*/
let campaignType = PromotionCampaignType.event
/*
small (band banner),
great(great banner),
rolling(rolling banner)
*/
let bannerType = PromotionBannerType.rolling
PromotionInterface.getBannerInfo(campaignType, bannerType: bannerType) { result, bannerInfoList in {
if result.isSuccess() {
// call successful
}
}
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
let campaignType = "event"
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
let bannerType = "rolling"
PromotionInterface.getBannerInfoString(campaignType, bannerString: bannerType) { result, bannerInfoList in {
if result.isSuccess() {
// API call successful
}
}
API Reference: HIVEPromotion getBannerInfo
#import <HIVEService/HIVEService-Swift.h>
/*
HIVEPromotionCampaignTypeAll (All);
HIVEPromotionCampaignTypeEvent(event);
HIVEPromotionCampaignTypeNotice(Notice);
HIVEPromotionCampaignTypeCross (Cross Banner)
*/
HIVEPromotionCampaignType campaignType = HIVEPromotionCampaignTypeEvent;
/*
HIVEPromotionBannerTypeSmall (band banner),
HIVEPromotionBannerTypeGreat(Great Banner),
HIVEPromotionBannerTypeRolling
*/
HIVEPromotionBannerType bannerType = kHIVEPromotionBannerTypeRolling;
[HIVEPromotion getBannerInfo: campaignType bannerType: bannerType handler: ^(HIVEResultAPI *result, NSArray *bannerInfos) {
if ([result isSuccess]) {
// call successful
}
}];
// Banner type and campaign type can also be called through strings instead of enumeration.
/*
"all" (all),
"event" (event),
"notice" (notice),
"cross" (Cross Great Banner)
*/
NSString *campaignType = @"event";
/*
"small" (band banner),
"great" (great banner),
"rolling" (rolling banner)
*/
NSString *bannerType = @"rolling";
[HIVEPromotion getBannerInfoString: campaignType, bannerString: bannerType, handler: ^(HIVEResultAPI *result, NSArray<HIVEPromotionBanner *> *bannerInfos) {
if ([result isSuccess]) {
// call successful
}
}];
API response: PromotionBannerInfo¶
In the API response, the banner information required to implement the banner is in the PromotionBannerInfo object (array). For more details, see the tabl below.
Field Name | Type | Description |
---|---|---|
pid | Integer | Promotion campaign ID |
imageUrl | String | The image URL of campaign banner |
linkUrl | String | The URL opening when user clicks a campaign banner |
displayStartDate | String | The start time of campaign |
displayEndDate | String | The end time of campaign |
utcStartDate | Integer | The start time of campaign (Unix timestamp) |
utcEndDate | Integer | The end time of campaign (Unix timestamp) |
typeLink | String | The type to open pages when user clicks a campaign banner. Select when registering campaigns. * webview: Open an internal link * webbrowser: Open an external link * market: Open the market (App Store) page * notice: Open the notice page * text: Open the promotion text notice * none: Stay on the page |
typeBanner | String | The type of campaign banner * great: Interstitial banner * small: Normal banner * rolling: Rolling banner |
typeCampaign | String | The campaign type of promotion * all: all * event: event * notice: notice * cross: cross interstitial banner |
interworkData | String | JSON data containing the API and parameters to move a user to a specific location in the game. This data is in String format. For example, if a user clicks on a customized event rolling banner, you can direct this user to a purchase screen for a specific event item. |
Campaign data search¶
Hive SDK provides a function to search campaign data registered on Hive Console. This function is useful when you directly show the contents of registered campaign on Hive Console in the game rather than using Promotion View. Following campaign type is available for search; Custom View, Custom Board, Spot Banner and Direct View. showCustomContents()
method of Promotion class can explain these four types.
Data form¶
Hive SDK returns promotion information with PromotionViewInfo
object array because spot banner is available to comprise several banners like interstitial banners. Even if custom view, custom board and direct view comprise single form, Hive returns the information of all campaigns with array type.
Following table is a composition of PromotionViewInfo
object.
Name | Type | Description |
---|---|---|
url | String | Page URL to be loaded by WebView |
postString | String | POST String required to load WebView |
Data search¶
To search campaign data registered on Hive Console, set the unique ID of promotion as the first parameter to call getViewInfo()
method of Promotion class. Then, return the callback method which receives campaign data. Followings are sample codes to request a campaign with unique ID, 310000. Samples for Android and iOS contain the codes displaying data from Hive SDK directly on WebView.
API Reference: hive.Promotion.getViewInfo
#include "HivePromotion.h"
EHivePromotionCustomType PromotionCustomType = EHivePromotionCustomType::VIEW;
FString ContentsKey = TEXT("123456");
FHivePromotion::GetViewInfo(PromotionCustomType,
ContentsKey,
FHivePromotionOnViewInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHivePromotionViewInfo>& PromotionViewInfoList) {
if (Result.IsSuccess()) {
// API call success
}
}));
API Reference: Promotion::getViewInfo
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std;
using namespace hive;
PromotionCustomType customType = PromotionCustomType::VIEW;
string contentsKey = "123456";
Promotion::getViewInfo(
customType,
contentsKey,
[=](ResultAPI result, vector promotionViewInfo) {
if (result.isSuccess()) {
// call successful
}
}
);
API Reference: Promotion.getViewInfo
import com.hive.Promotion
import com.hive.ResultAPI
val customType = Promotion.PromotionCustomType.VIEW
val contentsKey = "123456"
Promotion.getViewInfo(customType, contentsKey, object : Promotion.PromotionViewInfoListener {
override fun onReceiveInfo(result: ResultAPI, viewInfo: ArrayList<Promotion.PromotionViewInfo>?) {
if (result.isSuccess) {
// call successful
}
}
})
API Reference: com.hive.Promotion.getViewInfo
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionCustomType promotionCustomType = Promotion.PromotionCustomType.VIEW;
String contentsKey = "123456";
Promotion.INSTANCE.getViewInfo(promotionCustomType, contentsKey, (result, viewInfo) -> {
if (result.isSuccess()) {
// call successful
}
});
API Reference: PromotionInterface.getViewInfo
API Reference: HIVEPromotion:getViewInfo
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionCustomType promotionType = HIVEPromotionCustomTypeVIEW;
NSString *contentsKey = @"123456";
[HIVEPromotion getViewInfo: promotionType contents: contentsKey handler: ^(HIVEResultAPI *result, NSArray<HIVEPromotionViewInfo *> *infos) {
if ([result isSuccess]) {
// call successful
}
}];
Send additional information to Promotion server¶
The additional information here is the custom data defined by your game company. The game companies can forward additional information to the promotion server and use it for various services given the cooperations between a game company and Com2uS Platform. For example, you can define your game's player character level information in additionalInfo
as follows.
After sending the above additionalInfo
to promotion server using the setAdditionalInfo
method, please work with Com2uS Platform about the implementation details. For example, when exposing a specific event page (direct view, custom view, etc.), an event banner bordered in gold color can be displayed for a user with a game character at a level above 50. You can also use it as a function to add a gift box image to the news banner by entering the campaign number in additionalInfo
.
The following is an example code that passes additionalInfo
.
API Reference: hive.Promotion.setAdditionalInfo
using hive;
// Escape string processing according to the JSON Object version in the Unity package (must include backslash)
//Under Hive SDK 4.16.2
string additionalInfo = "{\\\"myData\\\":\\\"123\\\"}";
// Hive SDK 4.16.2 or later
string additionalInfo = "{\"myData\":\"123\"};
Promotion.setAdditionalInfo(additionalInfo)
API Reference: Promotion::setAdditionalInfo
API Reference: Promotion.setAdditionalInfo
API Reference: Promotion .INSTANCE.setAdditionalInfo
API Reference: PromotionInterface .setAdditionalInfo
API Reference: HIVEPromotion::setAdditionalInfo
The additional information can be used for all Hive SDK promotion features. Therefore, before implementing any promotion features, we recommend that you first call setAdditionalInfo
after defining the additional information and how it will be utilized.
Event display without title bar¶
You can delete Hive title bar on event page linked from interstitial banner, Spot Banner, news page, or Direct View. To display event page without Hive title bar, call setAdditionalInfo
method of Promotion class before calling showCustomContents()
method to set header field as Off
. You can remove the Hive title bar from an exposed page by organizing the additionalInfo and sending it to the Hive Server, described as below.
Followings are sample codes to release title bar.
API Reference: hive.Promotion.setAdditionalInfo
API Reference: Promotion::setAdditionalInfo
API Reference: Promotion.setAdditionalInfo
API Reference: Promotion.INSTANCE.setAdditionalInfo
API Reference: PromotionInterface .setAdditionalInfo
API Reference: HIVEPromotion setAdditionalInfo
Playing video clips on Promotion¶
Display a video clip on your game promotion with Hive SDK v4.7.0 and later. If user clicks a play link, the full-screen video shows up. To do this, make sure to code the functions which volume down before playing the video, and volume up after playing it.
- The state before and after displaying video clips are sent to the handler of API which implemented promotion. StartPlayback, FinishPlayback are sent to
PromotionViewResultType
; and kPromotionStartPlayback, kPromotionFinishPlayback are sent to the part of Result API code.- WebKit.framework and libz.tbd are new to the framework added to iOS Xcode.
Following is the sample code to control the game volume to play a video clip on promotion page.
API Reference: onPromotionView
using hive;
public void onPromotionViewCB(
ResultAPI result,
PromotionEventType viewEventType
) {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
case START_PLAYBACK:
// TODO: Mute game sound
break;
case FINISH_PLAYBACK:
// TODO: Resume game sound
break;
}
}
auto PromotionViewDelegate = FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (!Result.IsSuccess()) {
return;
}
// API call success
switch (PromotionEventType) {
case EHivePromotionEventType::OPEN:
// Open promotion view
break;
case EHivePromotionEventType::CLOSE:
// Close promotion view
break;
case EHivePromotionEventType::START_PLAYBACK:
// TODO: Mute game sound
break;
case EHivePromotionEventType::FINISH_PLAYBACK:
// TODO: 게임 사운드 재개
break;
default:
// Resume game sound
break;
}
});
API Reference: onPromotionView
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std;
using namespace hive;
void PromotionTest::onPromotionView(
ResultAPI result,
PromotionEventType viewEventType
) {
if (!result.isSuccess()) {
return;
}
// call successful
switch (viewEventType) {
case OPEN:
// Open promotion view
break;
case CLOSE:
// Close promotion view
break;
case START_PLAYBACK:
// TODO: Mute game sound
break;
case FINISH_PLAYBACK:
// TODO: Resume game sound
break;
}
}
API Reference: onPromotionView
import com.hive.Promotion
import com.hive.ResultAPI
val listener = object: Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (!result.isSuccess) {
return
}
// call successful
when (promotionEventType) {
Promotion.PromotionViewResultType.OPENED -> {
// Open promotion view
}
Promotion.PromotionViewResultType.CLOSED -> {
// Close promotion view
}
Promotion.PromotionViewResultType.START_PLAYBACK -> {
// TODO: Mute game sound
}
Promotion.PromotionViewResultType.FINISH_PLAYBACK -> {
// TODO: Resume game sound
}
else -> {}
}
}
}
API Reference: Promotion .PromotionViewListener
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionViewListener listener = (result, promotionEventType) -> {
if (!result.isSuccess()) {
return;
}
// call successful
switch (promotionEventType) {
case OPENED:
// Open promotion view
break;
case CLOSED:
// Close promotion view
break;
case START_PLAYBACK:
// TODO: Mute game sound
break;
case FINISH_PLAYBACK:
// TODO: Resume game sound
break;
default:
break;
}
};
API Reference: PromotionViewHandler
import HIVEService
let handler = {
(result : ResultAPI, viewResultType : PromotionViewResultType) in if !result.isSuccess() {
return
}
// call successful
switch viewResultType {
case.open:
// Open promotion view
case.close:
// Close promotion view
case.startPlayBack:
// TODO: Mute game sound
case.finishPlayBack:
// TODO: Resume game sound
}
}
API Reference: HIVEPromotionViewHandler
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionViewHandler handler = ^(HIVEResultAPI* result, HIVEPromotionViewResultType viewResultType) {
if (![result isSuccess]) {
return;
}
// call successful
switch (viewResultType) {
case HIVEPromotionViewResultTypeOpen:
// Open promotion view
break;
case HIVEPromotionViewResultTypeClose:
// Close promotion view
break;
case HIVEPromotionViewResultTypeStartPlayback:
// TODO: Mute game sound
break;
case HIVEPromotionViewResultTypeFinishPlayback:
// TODO: Resume game sound
break;
}
}
};