Skip to main content

Callback of the Notification Module (NoticeResultObserver)

If you are using Unreal Engine, see Unreal Engine SDK's NoticeResultObserver.

Register the callback for the Player Network SDK announcement module; the game needs to register the callback for processing.For more information on callback data structure, see NoticeResult.

note

It is strongly recommended that games register during the application start-up function.

Function definition

// Add INTLNoticeResult callback
public static void AddNoticeResultObserver(OnINTLResultHandler<INTLNoticeResult> callback);
// Remove INTLNoticeResult callback
public static void RemoveNoticeResultObserver(OnINTLResultHandler<INTLNoticeResult> callback);

Code sample

// Add callback
public void AddNoticeObserver()
{
INTLAPI.AddNoticeResultObserver(OnNoticeResultEvent);
}

// Remove callback
public void RemoveNoticeObserver()
{
INTLAPI.RemoveNoticeResultObserver(OnNoticeResultEvent);
}

// Callback handling of INTLNoticeResult
public void OnNoticeResultEvent(INTLNoticeResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
string methodTag = "";
if (noticeRet.MethodId == (int)INTLMethodID.INTL_NOTICE_REQUEST_DATA)
{
methodTag = "RequestNoticeData";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(noticeRet));
}