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 Hive 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 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 returns.
Field | Type | Description |
---|---|---|
target | Enumerator | Target promotion view to display a badge
|
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
|
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
1 2 3 4 5 6 7 8 9 10 11 12 13 |
using hive; Promotion.getBadgeInfo((ResultAPI result, List<PromotionBadgeInfo> badgeInfoList) => { if (!result.isSuccess()) { return; } // call successful foreach(PromotionBadgeInfo badgeInfo in badgeInfoList) { //TODO: // Display the badge } }); |
API Reference: Promotion::getBadgeInfo
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; 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import com.hive.Promotion; import com.hive.ResultAPI; Promotion.INSTANCE.getBadgeInfo((result, badgeInfoList) -> { if (!result.isSuccess()) { return; } // call successful for (Promotion.PromotionBadge badgeInfo : badgeInfoList){ //TODO: // Display the badge } }); |
API Reference: PromotionInterface.getBadgeInfo
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import HIVEService PromotionInterface.getBadgeInfo() { result, badgeInfoList in if !result.isSuccess() { return } // call successful for (badgeInfo in badgeInfoList) { //TODO: // Display the badge } } |
API Reference: HIVEPromotion:getBadgeInfo
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#import <HIVEService/HIVEService-Swift.h> [HIVEPromotion getBadgeInfo: ^(HIVEResultAPI *result, NSArray<HIVEPromotionBadge *> *badgeInfoList) { if (![result isSuccess]) { return; } // call successful for (HIVEPromotionBadge *badgeInfo in badgeInfoList) { //TODO: // Display the badge } }]; |