Notice
Unity3D
Outline
Access Guide
Display announcement
Hide scrolling announcement
Get announcement data
FAQ
Android
Outline
Access Guide
Display announcement
Hide scrolling announcement
Get announcement data
FAQ
IOS
Outline
Access Guide
Display announcement
Hide scrolling announcement
Get announcement data
FAQ
Others
Data Structure
System Tools
Notice / IOS / Outline

Outline

The notice module is an information notification system provided by MSDK for games. You can complete visual operations via MSDK notice management terminal. Through the notice system, you can inform events to all or specified users in the gaming course:

1)Operational failure; exceptions occur in the operation process. You can use the system to inform users of the exceptions and inform them of the expected recovery time

2)Stop and open server; you can inform users of your server's stopping and opening time so that the users can make reasonable arrangements for their gaming time in advance

3)Activity reminder; remind users to participate in game activities

Our notice has the following characteristics:

1)Accurate reach

Full-coverage notice        (all users can receive the message)

Notice by zone       (only users in the designated zone can receive the message)

Notice by the operating system  (only users of the specified operating system can receive the message; only Android and IOS operating systems are available)

Notice by the specified numbers  (only the specified numbers (QQ numbers, WeChat numbers) can receive the message)

2)Diversified scenes

Pre-login notice: you can make the full-coverage notice without login

Post-login notice: you can make various forms of notices after login

3)Data localization

All valid notices will be taken to the client and be stored there in advance. When you use a notice, the notice will be directly read from the client's local database and then be displayed.

4)UI in various forms

Pop-up UI notice (display the notice content in the form of the dialog box)

Scroll UI notice  (dynamically display the notice content in the form of the floating box)

Customized UI notice (you can use our notice data to show the customized UI)

5)Rich and varied content

Content supported: text, image, webpage

Different forms of notice UI for reference:

a) Pop-up text UI notice

b) Pop-up image UI notice

c) Pop-up webpage UI notice

d) Scroll UI notice

The above all are notices which use UI carried by MSDK itself. Games can call the interface WGShowNotice (scene) to pass the corresponding notice bar ID to take out the corresponding notice.

e) User-defined UI notices

Games using user-defined UI notices can call WGgetNoticeData (scene) to get notice data

6)Top notice function

For notices that are configured for top (it is allowed to choose whether to be top when configuring a notice), they will be displayed in priority. After the top notice is added, the data obtained when using MSDK's own notice UI or using the MSDK notice data interface will be arranged in the following order:

Notices set to the top (high priority) will precede those not set to the top (low priority).

Notices with the same priority (all topped or all not topped) are sorted according to the order in which they were created, the later they were created, the higher their orders are.

Access Guide

1 Preconditions

The game has set the notice function as YES in info.plist, for example:

In addition, the time for getting notices (in seconds) regularly can be configured, for example:

Precautions

1) The management terminal configures notices (may have to wait about 5min before the notice take effect)

2)Start or login games to draw notices; in addition, the notice module also has a timed notice-drawing mechanism (draw once every 10 minutes by default)

2 MSDK management terminal configures notices

MSDK management terminal's site: http://dev.ied.com

Take MSDKDemo notice as an example:

1)Enter MSDK management terminal ->MSDK management -> notice management

2)Notice management -> notice (test environment/formal environment) —> add notice

3) On the notice-adding page, input the notice's corresponding parameters; then click "Add notice" button to complete the notice configuration

3 Refer to demos

For examples, please refer toMSDKDemo/NoticeViewController.mm file's onClickShowNotice, onClickHideScrollNotice,  pickerView methods.

4 Precautions for joint debugging and test

1) Confirm the client configuration switch MSDK_URL=http://msdktest.qq.com(the selected environment is the same as the environment for the management terminal to configure notices) Refer to Access Configuration Step3 Configuration Information

2) Developers select notices (test environment), add notices and make joint debugging and test in the notice management terminal

3) The client makes tests according to notice types(pre-login, post-login, scroll, pop-up)configured by the management terminal. If an notice can't be displayed, please click FAQ and look for the causes according to the steps.

Display notice

General description

Call the interface used to display the notice you configure on the management terminal

Registration callback

None

Interface calling

1)Function description

Call the interface used to display the notice you configure on the management terminal

2)Interface declaration
void WGShowNotice(unsigned char *scene);
3)Parameter description
Parameter name Type Description
scene unsigned char * notice column ID, which can not be null; this parameter corresponds with the notice management terminal's "notice bar" setting
4)Return value

None, directly display the notice page

5)Demo code
NSString *currentScene = @"1";
WGPlatform::GetInstance()->WGShowNotice((unsigned char *)[currentScene UTF8String]);
6)Special description

1)The notice bar id (scene) used when calling the interface must correspond with the "notice bar" ID set by the notice management terminal**. Do not use the notice ID(msgid)to replace the notice bar ID

2)Calling WGShowNotice will use a set of UI configured by MSDK to display the currently valid notices. For pop-up notices, you can also set if they carry jump link. For notices with jump link, click "Details" to launch MSDK's inside webview to open the corresponding details URL.

7)Term interpretation

None

Hide scroll notice

General description

Hide the scroll notice that has been displayed

Registration callback

None

Interface calling

1)Function description

Hide the scroll notice that has been displayed

2)Interface declaration
void WGHideScrollNotice();
3)Parameter description

None

4)Return value

None, hide the scroll notice UI that is being displayed

5)Demo code
WGPlatform::GetInstance()->WGHideScrollNotice();
6)Special description

None

7)Term interpretation

None

Get notice data

General description

Read the specified valid notice data from the local database and return it to the caller

Registration callback

None

Interface calling

1)Function description

Read the specified valid notice data from the local database and return it to the caller

After MSDK3.2, the notice module supports user-defined passthrough strings. You can configure a user-defined string parameter on the Flying Eagle platform (dev.ied.com). After the notice is issued, it can be obtained in NoticeInfo.msg_custom. The user-defined string parameter is an utf8 encoded string with less than 512 bytes.
The game can configure user-defined strings according to the requirements. For example: If the game wants to realize the function of sending notices by area server, the game client can reach an agreement with the configuration staff on the configuration content of the field; the configuration information of the area server can be obtained through the "mNoticeCustom" field; and then the game can decide if the notice should be displayed according to the result of comparing the information from the area server with the configuration content of the field.

2)Interface declaration
std::vector<NoticeInfo> WGGetNoticeData(unsigned char *scene);
3)Parameter description
Parameter name Type Description
scene unsigned char * notice column ID,which can not be null; this parameter corresponds with the notice management terminal's "notice bar" setting
4)Return value

std::vector: for details about List of NoticeInfo struct, please see Definition and description of NoticeInfo

5)Demo code
NSString *scene = @"1";
std::vector<NoticeInfo> noticeInfos = WGPlatform::GetInstance()->WGGetNoticeData((unsigned char *)[scene UTF8String]);

    NSMutableArray *infosArray = [NSMutableArray new];
    for (int i = 0; i < noticeInfos.size(); i++)
    {
        NoticeInfo noticeInfo = noticeInfos[i];
        NSMutableDictionary *noticeInfoDic = [NSMutableDictionary new];
        NSString *msg_id = noticeInfo.msg_id.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.msg_id.c_str() encoding:NSUTF8StringEncoding];
        NSString *open_id = noticeInfo.open_id.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.open_id.c_str() encoding:NSUTF8StringEncoding];
        NSString *msg_url = noticeInfo.msg_url.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.msg_url.c_str() encoding:NSUTF8StringEncoding];
        NSString *msg_type = [NSString stringWithFormat:@"%d",noticeInfo.msg_type];
        NSString *msg_scene = noticeInfo.msg_scene.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.msg_scene.c_str() encoding:NSUTF8StringEncoding];
        NSString *start_time = noticeInfo.start_time.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.start_time.c_str() encoding:NSUTF8StringEncoding];
        NSString *end_time = noticeInfo.end_time.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.end_time.c_str() encoding:NSUTF8StringEncoding];
        NSString *content_type = [NSString stringWithFormat:@"%d",noticeInfo.content_type];
        NSString *content_url = noticeInfo.content_url.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.content_url.c_str() encoding:NSUTF8StringEncoding];
        NSMutableArray *picArray = [NSMutableArray new];
        for (int j = 0; j < noticeInfo.picArray.size(); j++)
        {
            NSMutableDictionary *picDict = [NSMutableDictionary new];
            PicInfo picInfo = noticeInfo.picArray[j];
            NSString *screenDir = [NSString stringWithFormat:@"%d",picInfo.screenDir];
            NSString *picPath = [NSString stringWithCString:(const char *)picInfo.picPath.c_str() encoding:NSUTF8StringEncoding];
            NSString *hashValue = [NSString stringWithCString:(const char *)picInfo.hashValue.c_str() encoding:NSUTF8StringEncoding];
            [picDict setObject:screenDir forKey:kScreenDir];
            [picDict setObject:picPath forKey:kPicUrl];
            [picDict setObject:hashValue forKey:kHashValue];

            [picArray addObject:picDict];
        }
        NSString *msg_title = noticeInfo.msg_title.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.msg_title.c_str() encoding:NSUTF8StringEncoding];
        NSString *msg_content = noticeInfo.msg_content.c_str() == NULL ? kNSNULL : [NSString stringWithCString:(const char *)noticeInfo.msg_content.c_str() encoding:NSUTF8StringEncoding];
        NSString *msg_order = [NSString stringWithFormat:@"%d",noticeInfo.msg_order];
        NSString *msg_custom = noticeInfo.msg_custom.c_str() == NULL ? kNSNULL:[NSString stringWithCString:noticeInfo.msg_custom.c_str() encoding:NSUTF8StringEncoding];
        [noticeInfoDic setObject:msg_id forKey:kMsgId];
        [noticeInfoDic setObject:open_id forKey:kopenId];
        [noticeInfoDic setObject:msg_url forKey:kMsgUrl];
        [noticeInfoDic setObject:msg_type forKey:kMsgType];
        [noticeInfoDic setObject:msg_scene forKey:kMessageScene];
        [noticeInfoDic setObject:start_time forKey:kBeginTime];
        [noticeInfoDic setObject:end_time forKey:kEndTime];
        [noticeInfoDic setObject:content_type forKey:kContentType];
        [noticeInfoDic setObject:content_url forKey:kContentUrl];
        [noticeInfoDic setObject:picArray forKey:kPicArray];
        [noticeInfoDic setObject:msg_title forKey:kMsgTitle];
        [noticeInfoDic setObject:msg_content forKey:kMsgContent];
        [noticeInfoDic setObject:msg_order forKey:kMsgOrder];
        [noticeInfoDic setObject:msg_custom forKey:kMsgCustom];
        [infosArray addObject:noticeInfoDic];
    }

    NSLog(@"\n\n\nDidGetNoticeData:\n%@\n\n\n",infosArray);
    self.apiTitle = @"notice data";
    self.apiMethod = @"WGGetNoticeData";
    self.apiDesc = @"success";
    self.apiResult = [NSString stringWithFormat:@"%@",infosArray];
6)Special description

The notice bar id (scene) used when calling the interface must correspond with the "notice bar" ID set by the notice management terminal. Do not use the notice ID(msgid)to replace the notice bar ID The image path in PicInfo is a local absolute path

7)Term interpretation

None

FAQ

1. Crash takes place when calling a notice

1) In the event of failure in importing WGPlatformResources.bundle properly into the project's "Copy Bundle Resources", Crash will take place when the notice is displayed.

2) In the event of failure in creating window property in AppDelegate(AppController), Crash will take place when the notice is called.

[AppController window]: unrecognized selector sent to instance 0x17fa7130

Solution: add one window property in AppDelegate(AppController), and let it point at keywindow created by it

Note: