Skip to main content

Callback for the Push module (GUAPushBaseResultObserver)

[MSDK & Player Network SDK] Register the callback for the Push module. The game needs to register the callback to process events.For more details on the callback data structure, see GUABaseResult.

note

It is strongly recommended that games register in the application startup function.

Function Definition

List of methods for handling callback events

Callback eventCommon[Player Network SDK only][MSD only]
PushBaseResultEventsRegisterPush,
UnregisterPush,
SetTag,
DeleteTag
*AddLocalNotificationAtFront
event OnResultHandler<GUABaseResult> PushBaseResultEvents;

Code Example

// Add callback
UnionAdapterAPI.GetPushService().PushBaseResultEvents += OnPushBaseResultEvent;
// Remove callback
UnionAdapterAPI.GetPushService().PushBaseResultEvents -= OnPushBaseResultEvent;

// Handling of PushBaseResultEvents callback
private void OnPushBaseResultEvent(GUABaseResult ret)
{
string methodTag = "";
if (ret.MethodId == (int)GUAMethodID.GUA_PUSH_REGISTER)
{
methodTag = "RegisterPush";
}
else if (ret.MethodId == (int)GUAMethodID.GUA_PUSH_UNREGISTER)
{
methodTag = "UnregisterPush";
}
else if (ret.MethodId == (int)GUAMethodID.GUA_PUSH_SET_TAG)
{
methodTag = "SetTag";
}
else if (ret.MethodId == (int)GUAMethodID.GUA_PUSH_DELETE_TAG)
{
methodTag = "DeleteTag";
}
Debug.Log(methodTag + ret.ToString());
}