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
1)The game has opened notice needNotice = true in msdk's configuration file msdkconfig.ini
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) EnterMSDK 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 The client accesses the notice module
For access to the notice module, please refer to Get notice data
4 Refer to demos
For examples, please refer to com\example\module\submodule\NoticeModule.java file's showAllTypeNotice(),callWGHideScrollNotice(),callWGGetNoticeData() methods.
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
1 Summary
Call the interface used to display the notice you configure on the management terminal
2 Registration callback
None
3 Interface calling
1)Function description
Call the interface used to display the notice you configure on the management terminal
2)Interface declaration
public static void WGShowNotice(string scene);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
scene | string | 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
string sceneString = "1";
WGPlatform.WGShowNotice(sceneString);
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)Name interpretation
None
Hide scroll notice
1 Summary
Hide the scroll notice that has been displayed
2 Registration callback
None
3 Interface calling
1)Function description
Hide the scroll notice that has been displayed
2)Interface declaration
public static void WGHideScrollNotice();
3)Parameter description
None
4)Return value
None, hide the scroll notice UI that is being displayed
5)Demo code
WGPlatform.WGHideScrollNotice();
6)Special description
None
7)Name interpretation
None
Get notice data
1 Summary
Read the specified valid notice data from the local database and return it to the caller
2 Registration callback
None
3 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.mNoticeCustom. 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
public static List<NoticeInfo> WGGetNoticeData(string scene);
3)Parameter description
Parameter name | Type | Description |
---|---|---|
scene | string | notice column ID, which can not be null; this parameter corresponds with the notice management terminal's "notice bar" setting |
4)Return value
List
NoticeInfo definition description
5)Demo code
std::vector<NoticeInfo> noticeVector =
WGPlatform::GetInstance()->WGGetNoticeData((unsigned char *)(cScene.c_str()));
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
FAQ
Check steps for a game notice which can't be displayed normally
-
Check if the notice module switch is turned on:
Check if the value of needNotice in the game package's assets/msdkconfig.ini is true. If not, change it to true and then debug; if yes, continue to check. Check method: check MSDK's log. If there is the following line of log, this indicates that the notice module is turned off:
WeGame NoticeManager.init notice module is closed!
If there is the following line of log, this indicates that the notice module has been turned on:
WeGame NoticeManager.init notice module init start!
Decompile the game package, find msdkconfig.ini file in assets directory, check whether needNotice is configured, and confirm that the value of needNotice is true.
-
Check if the notice environment is appropriate:
The notice data of MSDK formal environment and test environment are not interoperable, so the game needs to confirm if the environment configured by the notice management console is consistent with the domain name configured by the client.
The formal environment on the management side corresponds to the client domain name:
MSDK_URL=http://msdk.qq.com; 2.16.0 and later versions corresponds to MSDK_ENV=release
The test environment on the management side corresponds to the client domain name:
MSDK_URL=http://msdktest.qq.com; 2.16.0 and later versions corresponds to MSDK_ENV=test
-
Check if the called interface has valid content:
View MSDK log to see if there is any notice in the log of the called interface. If it is not 0, contact MSDK's related developer for confirmation; if it is 0, continue to check. Check method:
Check the value of noticeVector size in MSDK log:
WeGame NoticeDBModel.getNoticeRecordBySceneAndType query result:0 WeGame NoticeManager.getNoticeFromDBBySceneAndType noticeVector size:0
-
Check if appid for the obtained notice is correct:
Check the log of MSDK to see if appid of the gotten notice is correct. The notice appid before login is the combination of mobile QQ and WeChat appid. The notice appid after login is the corresponding platform appid. If it is not correct, please try again after modifying it at the initialization place; if it is correct, please continue to check. Check method:
See the value of appid in MSDK log when calling NoticeManager.getNoticeInfo, and then compare it with the dev backend and the timing of requesting the notice (whether or not to login) to see if it is correct. In particular, games which access only a single platform often fill the information of the remaining platforms arbitrarily, resulting in failure to get the notice:
WeGame NoticeManager.getNoticeInfo appid:100703379|wxcde873f99466f74a;openid: WeGame NoticeManager.getNoticeInfo Notice Model:mat_id may be null:860463020910104;mMatId:860463020910104
-
Check if the notice is issued from the management side to the client:
Clear the game's local data, and then restart the game, and then view MSDK's log to see if the notice list issued by the backend contains the configured notice. If not, contact MSDK's backend for confirmation; if yes, keep viewing. Check method:
View the return content of request/notice/gather_data/ in the MSDK log. A test case is as follows:
strResult:{"appid":"100703379|wxcde873f99466f74a","invalidMsgid":[{"invalidMsgid":"499"},{"invalidMsgid":"500"},{"invalidMsgid":"483"},{"invalidMsgid":"509"},{"invalidMsgid":"513"}],"list":[{"appid":"100703379|wxcde873f99466f74a","beginTime":"1403614800","contentType":2,"contentUrl":"http://www.qq.com","endTime":"1412168400","msgContent":"","msgUrl":"http://www.baidu.com","msgid":"528","noticeType":0,"openid":"","picUrlList":[],"scene":"10","title":""},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1403614800","contentType":1,"contentUrl":"","endTime":"1412168400","msgContent":"","msgUrl":"","msgid":"527","noticeType":0,"openid":"","picUrlList":[{"hashValue":"7a7ac418fb79917875cfd80c81ee4768","picUrl":"http://img.msdk.qq.com/notice/527/20140624211729_610X900.jpg","screenDir":1},{"hashValue":"2243f401734483f09ceeffd86006262d","picUrl":"http://img.msdk.qq.com/notice/527/20140624211739_1080X440.jpg","screenDir":2}],"scene":"10","title":""},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1403573435","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":"& && compatibility test cases,2& && about special characters","msgUrl":"","msgid":"490","noticeType":0,"openid":"","picUrlList":[],"scene":"10","title":"& && compatibility test 2&"},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1396575095","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":"Scrolling notice can't be entered with line breaks when configured. Why? \r\n\r\n","msgUrl":"","msgid":"491","noticeType":1,"openid":"","picUrlList":[],"scene":"11","title":""},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1396575095","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":"Here is a line break\r\n a line break,\r\n another line break\r\n Ah, there is another one\r\n Alright, I suppose this should be the last one\r\n My God, there is actually another one\r\n This is really the last one ","msgUrl":"","msgid":"492","noticeType":0,"openid":"","picUrlList":[],"scene":"10","title":"line break test"},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1396575095","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":"Here is a line break\r\n a line break,\r\n another line break\r\n Ah, there is another one\r\n Alright, I suppose this should be the last one\r\n My God, there is actually another one\r\n This is really the last one\r\n Click on the details below. I should skip, I skip\r\n","msgUrl":"http://im.qq.com","msgid":"493","noticeType":0,"openid":"","picUrlList":[],"scene":"10","title":"line break + skip test "},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1396575095","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":" Scrolling notice can't be entered with line breaks when configured. Why?\r\n\r\n","msgUrl":"","msgid":"494","noticeType":1,"openid":"","picUrlList":[],"scene":"11","title":""},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1396575095","contentType":0,"contentUrl":"","endTime":"1412127095","msgContent":"& && compatibility test cases,2& && about special characters*&……¥%……@#——+()?》《, I should appear in the scrolling notice board. There should be a scrolling notice next to me. Is it in front of me or behind me? ","msgUrl":"","msgid":"495","noticeType":1,"openid":"","picUrlList":[],"scene":"11","title":""},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1403229600","contentType":0,"contentUrl":"","endTime":"1404011100","msgContent":"Send a skip-containing notice to all users. The end time is very close from the current time","msgUrl":"http://www.qq.com","msgid":"487","noticeType":0,"openid":"","picUrlList":[],"scene":"1","title":" end time, skip "},{"appid":"100703379|wxcde873f99466f74a","beginTime":"1403748000","contentType":0,"contentUrl":"","endTime":"1403834400","msgContent":"WeChat+mobile QQ+android+scroll","msgUrl":"","msgid":"514","noticeType":1,"openid":"","picUrlList":[],"scene":"4","title":""}],"msg":"success","ret":0,"sendTime":"1403777179"}
The test case contains the contents of all notices. The game can narrow the search range according to the ID of notices configured in the backend notice, and see if a notice is issued.
-
Check if a notice is valid in the local time:
Check the log of MSDK to see the local time when the notice is called and displayed. If the local time is not within the valid period of the notice, please modify the local time and then debug. If the local time is within the valid period, please continue to check. Check method:
In the previous step, you can find the start time and end time of a notice and other relevant information. In the log of MSDK, view the value of currentTimeStamp when calling NoticeDBModel.getNoticeRecordBySceneAndType:
WeGame MsdkThreadManager.showNoticeByScene showNotice WeGame NoticeManager.setAppinfo mAppId:wxcde873f99466f74a;mOpenId:oGRTijsKcz0dOi__dwJTZmINGfx0 WeGame NoticeDBModel.getNoticeRecordBySceneAndType appId:wxcde873f99466f74a,openid:oGRTijsKcz0dOi__dwJTZmINGfx0,scene:10,noticetype:eMSG_NOTICETYPE_ALERT,currentTimeStamp:1403835077 WeGame NoticeDBModel.getNoticeRecordBySceneAndType query result:5
Compare the local time obtained when the notice is gotten, and then compare and see if the local time is within the valid period of the notice (within the interval between the start time and end time of the notice).
-
Check if the called interface's parameters are correct:
Compare MSDK's log and the game's configuration in the notice management side to see if the called configuration of the notice interface is consistent with the backend. If not, modify it and then debug; if yes, continue to check. Check method:
In the log of MSDK, see logs similar to the following one:
WeGame NoticeDBModel.getNoticeRecordBySceneAndType appId:100703379|wxcde873f99466f74a,openid:,scene:11,noticetype:eMSG_NOTICETYPE_SCROLL,currentTimeStamp:1409632268
Check the value of scene and noticetype passed when the notice is called and see if them are consistent with those configured by the game in the notice management console In particular, the value of scene corresponds to the notice column ID of the notice configured in the notice management console.
-
Check if the game's appid is configured correctly:
Compare appid configured by the game in onCreate and see if it is the same as the one registered in the open platform; if no, then modify it and then debug; if yes, contact MSDK developer to solve the problem.