Display interstitial banners
Hive SDK provides a interstitial banner to
- Expose events effectively to game users
- Encourage users for more participation in games
- Utilize as cross-promotions to advertise other games and give reward
The banner defined by Hive means a Promotion view composed of a single image without letters. If the user clicks the banner, it take the user to the detail page, the external page, or the download page of the game being advertised according to the contents configured in the Hive Console. We recommend you to expose interstitial banner, which displays the banner image in full screen, when user enter the game lobby after login.
Registering a Interstitial Banner on Hive Console¶
Design the banner image according to the horizontal and vertical mode as follows, and register it on the Hive Console. For more information about banner registration, see Guide for Hive Console Promotion.
- Promotion banner image sizes
- Landscape mode: 1080x720 px
- Portrait mode: 720x1080 px
- If you want to display high-resolution banners in a PC environment, please upload images of 2160x1440 px.
Displaying Interstitial Banners¶
- An example of a interstitial banner
To display a interstitial banner, call showPromotion()
method from Promotion class with PromotionType.BANNER
parameter. From Hive SDK v4.12.1, PromotionType.BANNER
displays web-type banner, and other parameters display image view-type banner. When you call PromotionType.BANNERLEGACY
, webview-type banner is displayed as usual.
When displaying a full banner with the PromotionType.BANNER
type, the images stored asynchronously in the app's local storage during the Hive SDK initialization process will be displayed. If there are no cached images, the images will be downloaded immediately for display.
The "Don't show for n days." feature at the bottom of the front banner allows you to set a period of 1 to 7 days for not displaying the front banner when registered in the Hive console. The basis for stopping display is at midnight local time of the respective region when the date changes. For more details, please refer to the console promotion guide.
Note
The PromotionType.BANNER
type does not support the isForced
option.
The followings are sample codes to display a interstitial banner.
API Reference: hive.Promotion.showPromotion
using hive;
PromotionType promotionViewType = PromotionType.BANNER;
// isForced is ignored when PromotionType.BANNER
Boolean isForced = false;
// Display a large banner
Promotion.showPromotion(promotionViewType, isForced, (ResultAPI result, PromotionEventType viewEventType) => {
if (result.isSuccess()) {
// call successful
}
});
#include "HivePromotion.h"
EHivePromotionType PromotionType = EHivePromotionType::BANNER;
// isForced is ignored when EHivePromotionType::BANNER
bool bIsForced = false;
FHivePromotion::ShowPromotion(PromotionType, bIsForced, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (Result.IsSuccess()) {
// call successful
}
}));
API Reference: Promotion::showPromotion
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionType promotionViewType = PromotionType::BANNER;
// isForced is ignored when PromotionType::BANNER
bool isForced = false;
Promotion::showPromotion(promotionViewType, isForced, [=](ResultAPI result, PromotionEventType viewEventType) {
if (result.isSuccess()) {
// call successful
}
});
API Reference: Promotion.showPromotion
import com.hive.Promotion;
import com.hive.ResultAPI;
val promotionViewType = Promotion.PromotionViewType.BANNER
// isForced is ignored when Promotion.PromotionViewType.BANNER
val isForced = false
Promotion.showPromotion(promotionViewType, isForced, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (result.isSuccess) {
// call successful
}
}
})
API Reference: com.hive.Promotion.showPromotion
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionViewType promotionViewType = Promotion.PromotionViewType.BANNER;
// isForced is ignored when Promotion.PromotionViewType.BANNER
boolean isForced = false;
Promotion.INSTANCE.showPromotion(promotionViewType, isForced, (result, promotionEventType) -> {
if (result.isSuccess()) {
// call successful
}
});
API Reference: PromotionInterface.showPromotion
API Reference: HIVEPromotion::showPromotion
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionViewType promotionViewType = HIVEPromotionViewTypeBANNER;
// isForced is ignored when HIVEPromotionViewTypeBANNER
BOOL isForced = NO;
[HIVEPromotion showPromotion: promotionViewType isForced: isForced handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if ([result isSuccess]) {
// call successful
}
}];
Control interstitial banner for cross-promotion¶
When you call the showPromotion()
method, all previously registered interstitial banners were displayed. Starting from Hive SDK v4 24.2.0, you can choose whether to show cross-promotion interstitial banners.
If you call Configuration.setCrossPromotionBannerShowing(false)
before calling the showPromotion()
method, cross-promotion interstitial banners will not be shown when the app is launched. If you call it with true
, the banners will be shown. This method continues to affect the app as long as it remains active, so it only needs to be called once after the Hive SDK is initialized and before the showPromotion()
method is called. You can change the visibility of the banners by calling this method again with a different value (true
or false
) while the app is active.
Note
When displaying cross-promotion full ads through the spot banner using the showCustomContents()
method, it is also affected by the call to Configuration.setCrossPromotionBannerShowing()
.
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
// Set the cross-promotion interstitial banner to not show (false)
Configuration::setCrossPromotionBannerShowing(false);
// Return the status of cross-promotion interstitial banner displaying
bool crossPromotionBannerShowing = Configuration::getCrossPromotionBannerShowing();
import com.hive.Configuration
// Set the cross-promotion interstitial banner to not show (false)
Configuration.setCrossPromotionBannerShowing(false)
// Return the status of cross-promotion interstitial banner displaying
val crossPromotionBannerShowing = Configuration.getCrossPromotionBannerShowing()
import com.hive.Configuration;
// Set the cross-promotion interstitial banner to not show (false)
Configuration.INSTANCE.setCrossPromotionBannerShowing(false);
// Return the status of cross-promotion interstitial banner displaying
boolean crossPromotionBannerShowing = Configuration.INSTANCE.getCrossPromotionBannerShowing();
import HIVEService
// Set the cross-promotion interstitial banner to not show (false)
ConfigurationInterface.setCrossPromotionBannerShowing(false)
// Return the status of cross-promotion interstitial banner displaying
var crossPromotionBannerShowing: Bool = ConfigurationInterface.getCrossPromotionBannerShowing()
#import <HIVEService/HIVEService-Swift.h>
// Set the cross-promotion interstitial banner to not show (false)
[HIVEConfiguration setCrossPromotionBannerShowing:false];
// Return the status of cross-promotion interstitial banner displaying
BOOL crossPromotionBannerShowing = [HIVEConfiguration getCrossPromotionBannerShowing];
#import <HIVEService/HIVEService-Swift.h>
// Set the cross-promotion interstitial banner to not show (false)
[HIVEConfiguration setCrossPromotionBannerShowing:false];
// Return the status of cross-promotion interstitial banner displaying
BOOL crossPromotionBannerShowing = [HIVEConfiguration getCrossPromotionBannerShowing];