Skip to main content

Push module callback (PushResultObserver)

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

Register the callback for the Player Network SDK Push module; the game needs to register the callback for handling.For more information on the callback data structure, see PushResult.

note

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

Function definition

// Add INTLPushResult callback
public static void AddPushResultObserver(OnINTLResultHandler<INTLPushResult> callback);
// Remove INTLPushResult callback
public static void RemovePushResultObserver(OnINTLResultHandler<INTLPushResult> callback);

Code sample

// Add callback
public void AddPushObserver()
{
INTLAPI.AddPushResultObserver(OnPushNotificationEvent);
}

// Remove callback
public void RemovePushObserver()
{
INTLAPI.RemovePushResultObserver(OnPushNotificationEvent);
}

// Callback processing for INTLPushResult
public void OnPushNotificationEvent(INTLPushResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");

if (ret.MethodId == (int)INTLMethodID.INTL_PUSH_NOTIFICAITON_CALLBACK)
{
methodTag = "PushNotificationCallback";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(ret));
}