Display news page
On News page, you can see the event banners and notice of the games registered in Hive Console together on one page.
Note
The Coupon Exchange appears on the News page on Android device only.
Configuring news page¶
Register the contents of Notice, Cross-promotion and Event banner, which compose News page, on Hive Console. You can specify the sequence of components, for example, whether to place notice at the top or event banners at the top and whether to display the badage notifying the imminent end of an event and the badge notifying the available period one can receive gifts from the Hive Console. For more information about registration, see Hive Console Promotion.
Displaying news page¶
To show up the news page, set promotionType
as PromotionType.NEWS
and call showPromotion()
method in the Promotion class.
Followings are sample codes to display a news page.
API Reference: hive.Promotion.showPromotion
using hive;
PromotionType promotionViewType = PromotionType.NEWS;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
Boolean isForced = false;
Promotion.showPromotion(promotionViewType, isForced, (ResultAPI result, PromotionEventType viewEventType) => {
if (result.isSuccess()) {
// call successful
}
});
#include "HivePromotion.h"
EHivePromotionType PromotionType = EHivePromotionType::NEWS;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
bool bIsForced = false;
FHivePromotion::ShowPromotion(PromotionType, bIsForced, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (Result.IsSuccess()) {
// API call success
}
}));
API Reference: Promotion::showPromotion
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionType promotionViewType = PromotionType::NEWS;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
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.NEWS
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
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.NEWS;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
boolean isForced = false;
Promotion.INSTANCE.showPromotion(promotionViewType, isForced, (result, promotionEventType) -> {
if (result.isSuccess()) {
// call successful
}
});
API Reference: PromotionInterface.showPromotion
import HIVEService
let promotionViewType: PromotionViewType = .news
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
let isForced = false
PromotionInterface.showPromotion(promotionViewType, isForced: isForced) { result, viewResultType in
if result.isSuccess() {
// call successful
}
}
API Reference: HIVEPromotion::showPromotion
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionViewType promotionViewType = HIVEPromotionViewTypeNews;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it not to be viewed again today, it is ignored and the news page is displayed.
BOOL isForced = NO;
[HIVEPromotion showPromotion: promotionViewType isForced: isForced handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if ([result isSuccess]) {
// call successful
}
}];
- "Do not display News page again" option
You can let users choose not to watch the news page for a day. To activate a checkbox not to show up the page, setisForced
parameter asfalse
when callingshowPromotion()
method in the Promotion class. - Displaying News page by force
If you do not provide users with the option "Do not display this page again", or even if the user has already opted not to view it for a day, but if you want to ignore the user's preferences and display the news page to the user, you can setisForced
parameter totrue
when callingshowPromotion()
method in the Promotion class.
If you setisForced
parameter astrue
, News page does not show a checkbox to tick "Do not display this page again". Even the user already ticked "Do not display this page again", News page is forcibly shown up.
Displaying news page with notice activated¶
To display the News page with Notice only, set promotionType
as PromotionType.NOTICE
, and call showPromotion()
method in the Promotion class.
Followings are sample codes to display a list of notice.
API Reference: hive.Promotion.showPromotion
using hive;
PromotionType promotionViewType = PromotionType.NOTICE;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
Boolean isForced = false;
Promotion.showPromotion(promotionViewType, isForced, (ResultAPI result, PromotionEventType viewEventType) => {
if (result.isSuccess()) {
// call successful
}
});
#include "HivePromotion.h"
EHivePromotionType PromotionType = EHivePromotionType::Notice;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
bool bIsForced = false;
FHivePromotion::ShowPromotion(PromotionType, bIsForced, FHivePromotionViewDelegate::CreateLambda([this](const FHiveResultAPI& Result, const EHivePromotionEventType& PromotionEventType) {
if (Result.IsSuccess()) {
// API call success
}
}));
API Reference: Promotion ::showPromotion
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace std;
using namespace hive;
PromotionType promotionViewType = PromotionType::NOTICE;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
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.NOTICE
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
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: Promotion .INSTANCE.showPromotion
import com.hive.Promotion;
import com.hive.ResultAPI;
Promotion.PromotionViewType promotionViewType = Promotion.PromotionViewType.NOTICE;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
boolean isForced = false;
Promotion.INSTANCE.showPromotion(promotionViewType, isForced, (result, promotionEventType) -> {
if (result.isSuccess()) {
// call successful
}
});
API Reference: PromotionInterface.showPromotion
import HIVEService
let promotionViewType: PromotionViewType = .notice
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
let isForced = false
PromotionInterface.showPromotion(promotionViewType, isForced: isForced) { result, viewResultType in
if result.isSuccess() {
// call successful
}
}
API Reference: HIVEPromotion showPromotion
#import <HIVEService/HIVEService-Swift.h>
HIVEPromotionViewType promotionViewType = HIVEPromotionViewTypeNotice;
// If true, the 'Do not watch again today' button will not be displayed. Even if the user has already set it to not be viewed again today, it will be ignored and the notice page will be displayed.
BOOL isForced = NO;
[HIVEPromotion showPromotion: promotionViewType isForced: isForced handler: ^(HIVEResultAPI *result, HIVEPromotionViewResultType viewResultType) {
if ([result isSuccess]) {
// call successful
}
}];
Displaying news page with a particular menu activated¶
To display the News page with a particular menu, call showNews()
method in the Promotion class with promotionType
as a parameter which registered in setting News page.
Followings are sample codes to display the News page with a particular menu activated.
API Reference: hive .Promotion.showNews
API Reference: Promotion ::showNews
API Reference: Promotion.showNews
import com.hive.Promotion
import com.hive.ResultAPI
val menu = "Promotion type registered in Hive Console"
Promotion.showNews(menu, null, object : Promotion.PromotionViewListener {
override fun onPromotionView(result: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
if (result.isSuccess) {
// call successful
}
}
})
API Reference: Promotion .INSTANCE.showNews
API Reference: PromotionInterface.showNews
API Reference: HIVEPromotion showNews
Display a news page highlighting an achieved event banner¶
To display the news page highlighting accomplished events, use the achieved event banner number (pid
) as a parameter when calling the Promotion class showNews()
method. The following is an example code to display a news page highlighting the achieved event banner when a gamer achieved a specific event.
API Reference: hive.Promotion.showNews
// Set the parameter to activate the event menu
String menu = "event";
// Set the Pid list for the achieved event banner to distinguish the achieved event banner.
List<int> giftPidList = [101331, 121881, 253120, 100002]; // Pid example
// the callback handler of the result of exposing the news page with the event menu activated
public void onPromotionViewCB(ResultAPI result, PromotionEventType promotionEventType) { if(result.isSuccess()){ // API call succeeded } }
// Expose the news page with the event menu activated
hive.Promotion.showNewsmenu, giftPidList, onPromotionViewCB);
API Reference: Promotion::showCustomContents
// Set the parameter to activate the event menu
string menu = "event";
// Set the Pid list for the achieved event banner to distinguish the achieved event banner.
std::vector<int> giftPidList = {101331, 121881, 253120, 100002}; // Pid example
// Expose the news page with the event menu activated
Promotion::showNewsmenu, giftPidList, [=]ResultAPI result, PromotionEventType promotionEventType){
// the callback handler of the result of exposing the news page with the event menu activated
if(result.isSuccess()){ // API call succeeded } });
API Reference: com.hive.Promotion.showCustomContents
// Set the parameter to activate the event menu
val menu: String = "event"
// Set the Pid list for the achieved event banner to distinguish the achieved event banner.
val giftPidList = arrayListOf(101331, 121881, 253120, 100002) // Pid Example
// Expose the news page with the event menu activated
Promotion.showNewsmenu, giftPidList, object : Promotion.PromotionViewListener {
override fun onPromotionViewresult: ResultAPI, promotionEventType: Promotion.PromotionViewResultType) {
// the callback listener of the result of exposing the news page with the event menu activated
if (result.isSuccess) {
// Successful API Call
}
}
}
API Reference: com.hive.Promotion.showCustomContents
// Set the parameter to activate the event menu
String menu = "event";
// Set the pid list for the achieved event banner to distinguish the achieved event banner.
ArrayList<Integer> giftPidList = new ArrayList<Integer>(Arrays.asList1, 2, 3, 4));
// Expose the news page with the event menu activated
Promotion.showNewsmenu, giftPidList, new PromotionViewListener) { @Override public void onPromotionView@NotNull ResultAPI result, @NotNull PromotionViewResultType promotionEventType) {
// the callback listener of the result of exposing the news page with the event menu activated
if (result.isSuccess) { // API call succeeded } } });
API Reference: HivePromotion:showCustomContents
// Set the parameter to activate the event menu
String menu = "event"
// Set the Pid list for the achieved event banner to distinguish the achieved event banner.
let giftPidList = [101331, 121881, 253120, 100002] // Example Pid
// Expose the news page with the event menu activated
HivePromotion.showNewsmenu: menu, giftPidList: giftPidList) { result, type in
// the callback listener of the result of exposing the news page with the event menu activated
if result.isSuccess {
// Successful API Call
}
}
API Reference: HivePromotion:showCustomContents
// Set the parameter to activate the event menu
NSString *menu = @"event";
// Set the Pid list for the achieved event banner to distinguish the achieved event banner.
NSArray *giftPidList = @[@101331, @121881, @253120, @100002]; // Pid example
// Expose the news page with the event menu activated
[HIVEPromotion showNewsWithMenu:menu giftPidList:giftPidList handler:^HIVEResultAPI * result, HIVEPromotionViewResultType type) {
// the callback listener of the result of exposing the news page with the event menu activated
if (result.isSuccess) {
// Successful API Call
}
}];
Adding data renewal API¶
Warning
Game studio is required to add this API.
News page data is sent through a communication with Hive Server after sign-in. If user changes the settings in game such as game language and game server, data renewal is needed. Data may not be updated to the latest if user goes on a long gaming binge. In these cases, game studio is required to manually renew the data on News page when user access to game lobby. Call updatePromotionData()
method in the Promotion class for data renewal.
Followings are sample codes to renew the News data.
API Reference: hive.Promotion.updatePromotionData
API Reference: Promotion::updatePromotionData
API Reference: Promotion.updatePromotionData
API Reference: Promotion.INSTANCE.updatePromotionData
API Reference: PromotionInterface.updatePromotionData
API Reference: HIVEpromotion updatePromotionData
Adding improved data renewal API¶
Warning
Game studio is required to add this API. You don't have to add this API if you're already using the API before being improved. Improvements from the existing API are as follows.
- The logic of calling 'updatePromotionData API' after calling 'setServerID API' has been improved so that the same operation is performed by calling the updateServerID API only once.
- The logic of calling 'pdatePromotionData API' after calling 'setGameLanguage API' has been improved so that it works the same by calling the 'updateGameLanguage API' only once.
The following is an example code to add the improved Data Renewal API
API Reference: hive.Promotion.updateServerId
API Reference: hive.Promotion.updateGameLanguage
API Reference: Promotion.updateServerId
API Reference: Promotion.updateGameLanguage
API Reference: Configuration.updateServerId
API Reference: Configuration.updateGameLanguage
API Reference: com.hive.Promotion.updateServerId
API Reference: com.hive.Promotion.updateGameLanguage
API Reference: ConfigurationInterface .updateServerId
API Reference: ConfigurationInterface .updateGameLanguage
API Reference: HIVEPromotion::updateServerId
API Reference: HIVEPromotion::updateGameLanguage