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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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; } }); |
API Reference: Promotion::showCustomContents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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; } }); |
API Reference: Promotion::showCustomContents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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 successful switch (viewEventType) { case OPEN: // Open promotion view break; case CLOSE: // Close promotion view break; } }); |
API Reference: Promotion.showCustomContents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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; } }); |
API Reference: Promotion::showCustomContents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#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; } }]; |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
using 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#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.
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.
API Request Example
API Reference: hive .Promotion.getBannerInfo
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 |
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 } }); |
API Reference: Promotion ::getBannerInfo
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 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
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
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 |
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
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 |
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
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 |
#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.
|
typeBanner | String | The type of campaign banner
|
typeCampaign | String | The campaign type of promotion
|
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 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 Hive 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 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 directly on WebView.
API Reference: hive.Promotion.getViewInfo
1 2 3 4 5 6 7 8 9 10 |
using hive; PromotionCustomType customType = PromotionCustomType.VIEW; String contentsKey = "123456"; Promotion.getViewInfo(customType, contentsKey, (ResultAPI result, List promotionViewInfoList) => { if (result.isSuccess()) { // call successful } }); |
API Reference: Promotion::getViewInfo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#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
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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
1 2 3 4 5 6 7 8 9 10 11 |
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
1 2 3 4 5 6 7 8 9 10 11 12 |
import HIVEService let promotionType = PromotionCustomType.view let contentsKey = "123456" PromotionInterface.getViewInfo(promotionType, contents : contentsKey) { result, infos in if result.isSuccess() { // call successful } } |
API Reference: HIVEPromotion:getViewInfo
1 2 3 4 5 6 7 8 9 10 |
#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 Hive 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.
1 2 3 4 5 |
{ "account_id": 1000338, "account_name": "test_account", "player_level": 50 } |
After sending the above
additionalInfo
to Hive 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
1 2 3 4 5 6 7 8 9 10 |
using hive; // Escape string processing according to the JSON Object version in the Unity package (must include backslash) //Under Hive 4.16.2 string additionalInfo = "{\\\"myData\\\":\\\"123\\\"}"; // Hive 4.16.2 or later string additionalInfo = "{\"myData\":\"123\"}; Promotion.setAdditionalInfo(additionalInfo) |
API Reference: Promotion::setAdditionalInfo
1 2 3 4 5 6 7 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; string additionalInfo = "{\"myData\":\"123\"}; Promotion::setAdditionalInfo(additionalInfo); |
API Reference: Promotion.setAdditionalInfo
1 2 3 4 5 |
import com.hive.Promotion val additionalInfo = "{\"myData\":\"123\"}" Promotion.setAdditionalInfo(additionalInfo) |
API Reference: Promotion .INSTANCE.setAdditionalInfo
1 2 3 4 5 |
import com.hive.Promotion; String additionalInfo = "{\"myData\":\"123\"}"; Promotion.INSTANCE.setAdditionalInfo(additionalInfo); |
API Reference: PromotionInterface .setAdditionalInfo
1 2 3 4 5 |
import HIVEService let additionalInfo = "{\"myData\":\"123\"}" PromotionInterface.setAdditionalInfo(additionalInfo) |
API Reference: HIVEPromotion::setAdditionalInfo
1 2 3 4 5 |
#import <HIVEService/HIVEService-Swift.h> NSString *additionalInfo = @"{\"myData\":\"123\"}"; [HIVEPromotion setAdditionalInfo: additionalInfo]; |
The additional information can be used for all Hive SDK promotion features. Therefore, before implementing any Hive 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
1 2 3 4 5 6 7 8 9 |
using hive; //Under Hive 4.16.2 string additionalInfo = "{\\\"header\\\":\\\"off\\\"}"; // Hive 4.16.2 or later string additionalInfo = "{\"header\":\"off\"}"; Promotion.setAdditionalInfo(additionalInfo) |
API Reference: Promotion::setAdditionalInfo
1 2 3 4 5 6 7 |
#include <HIVE_SDK_Plugin/HIVE_CPP.h> using namespace std; using namespace hive; string additionalInfo = "{\"header\":\"off\"}"; Promotion::setAdditionalInfo(additionalInfo); |
API Reference: Promotion.setAdditionalInfo
1 2 3 4 5 |
import com.hive.Promotion val additionalInfo = "{\"header\":\"off\"}" Promotion.setAdditionalInfo(additionalInfo) |
API Reference: Promotion.INSTANCE.setAdditionalInfo
1 2 3 4 5 |
import com.hive.Promotion; String additionalInfo = "{\"header\":\"off\"}"; Promotion.INSTANCE.setAdditionalInfo(additionalInfo); |
API Reference: PromotionInterface .setAdditionalInfo
1 2 3 4 5 |
import HIVEService let additionalInfo = "{\"header\":\"off\"}" PromotionInterface.setAdditionalInfo(additionalInfo) |
API Reference: HIVEPromotion setAdditionalInfo
1 2 3 4 5 |
#import <HIVEService/HIVEService-Swift.h> NSString *additionalInfo = @"{\"header\":\"off\"}"; [HIVEPromotion setAdditionalInfo: additionalInfo]; |
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
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 |
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; } } |
API Reference: onPromotionView
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 |
#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
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 |
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
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 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#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; } } }; |