Promotion Badge
Promotion Badge is an indicator added to in-game buttons or icons to notify that new promotion is registered.
What does Promotion Badge do?¶
Promotion badge is a function that informs users when a new promotion is registered and exposed, by delivering that information to the game client. It can be applied to the promotion features like the interstitial banner, custom view, custom board and notice icon.
Implementing Promotion Badge UI¶
The Hive SDK sends "badge ON" if a promotion item is new and "badge OFF" if it is not new to the game client. The exposure of badge must be implemented on the game side using this ON/OFF information.
Example screen of promotion badge
Badge data format¶
Hive SDK returns PromotionBadgeInfo
object holding only the information of promotion view as an array. If there is no target promotion view for which the badge should be displayed, an empty array is returned. The following table describes the composition of PromotionBadgeInfo
object which Hive SDK returns.
Field | Type | Description |
---|---|---|
target | Enumerator | Target promotion view to display a badge PromotionBadgeTarget.NEWS : News page PromotionBadgeTarget.NOTICE : Notice list PromotionBadgeTarget.CUSTOMVIEW : Custom view PromotionBadgeTarget.CUSTOMBOARD : Custom board |
contentsKey | String | Identifier registered in the Hive Console when the promotion view of the badge is a custom web view or custom board. If the promotion view is a news or notice list, null is returned |
badgeType | String | Badge type to display * "new" : Default value. Available to expose the badge in the form implemented in the game side. |
Search Badge data¶
To search badge data, call getBadgeInfo()
method of Promotion class. You can receive the data through callback function transmitted as a function parameter. Followings are sample codes to search badge data.
API Reference: hive.Promotion.getBadgeInfo
#include "HivePromotion.h"
FHivePromotion::GetBadgeInfo(FHivePromotionOnBadgeInfoDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHivePromotionBadgeInfo>& PromotionBadgeInfoList) {
if (!Result.IsSuccess()) {
return;
}
for (const auto& PromotionBadgeInfo : PromotionBadgeInfoList) {
// TODO: Display the badge
}
}));
API Reference: Promotion::getBadgeInfo
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
Promotion::getBadgeInfo([=](ResultAPI result, vector<PromotionBadgeInfo> badgeInfoList) {
if (!result.isSuccess()) {
return;
}
// call successful
for_each(badgeInfoList.begin(), badgeInfoList.end(), [=](PromotionBadgeInfo badgeInfo) {
//TODO:
// Display the badge
}
});
API Reference: Promotion.getBadgeInfo
import com.hive.Promotion
import com.hive.ResultAPI
Promotion.getBadgeInfo(object : Promotion.PromotionBadgeInfoListener {
override fun onReceiveInfo(result: ResultAPI, badgeInfoList: ArrayList<Promotion.PromotionBadge>?) {
if (!result.isSuccess) {
return
}
badgeInfoList?.forEach {
//TODO:
// Display the badge
}
}
})
API Reference: Promotion.INSTANCE.getBadgeInfo
API Reference: PromotionInterface.getBadgeInfo
API Reference: HIVEPromotion:getBadgeInfo