Push module callback (PushBaseResultObserver)
Register the callback for the Player Network SDK Push module. The game needs to register the callback to handle it.For more information on the callback data structure, please refer to BaseResult.
note
It is strongly recommended that games register during the application start-up function.
Function definition
// Add INTLBaseResult callback
public static void AddPushBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);
// Remove INTLBaseResult callback
public static void RemovePushBaseResultObserver(OnINTLResultHandler<INTLBaseResult> callback);
Code sample
// Add callback
public void AddPushObserver()
{
INTLAPI.AddPushBaseResultObserver(OnPushBaseRetEvent);
}
// Remove callback
public void RemovePushObserver()
{
INTLAPI.RemovePushBaseResultObserver(OnPushBaseRetEvent);
}
// Callback handling of INTLBaseResult
public void OnPushBaseRetEvent(INTLBaseResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
if (ret.MethodId == (int)INTLMethodID.INTL_PUSH_REGISTER_PUSH)
{
methodTag = "RegisterPush";
}
else if (ret.MethodId == (int)INTLMethodID.INTL_PUSH_UNREGISTER_PUSH)
{
methodTag = "UnregisterPush";
}
else if (ret.MethodId == (int)INTLMethodID.INTL_PUSH_SET_TAG)
{
methodTag = "SetTag";
}
else if (ret.MethodId == (int)INTLMethodID.INTL_PUSH_DELETE_TAG)
{
methodTag = "DeleteTag";
}
ShowLogInNewLine(methodTag + Tools.Instance.GetRetString(ret));
}