Skip to main content

GUAPushResultObserver

[MSDK & Player Network SDK] Register the callback of the Push module, the game needs to process the callback function. For more information on the callback data structure, see GUAPushResult.

note

It is strongly recommended to perform registration in the startup function of the game application.

Function Definition

The list of methods used to process the callback events.

Callback EventCommon[Player Network SDK Only][MSDK Only]
PushNotificationEventsAddLocalNotification,
ClearLocalNotification
--
event OnResultHandler<GUAPushResult> PushNotificationEvents;

Code Sample

// Add callbacks
UnionAdapterAPI.GetPushService().PushNotificationEvents += OnPushNotificationEvent;
// Remove callbacks
UnionAdapterAPI.GetPushService().PushNotificationEvents -= OnPushNotificationEvent;

// PushNotificationEvents callback
private void OnPushNotificationEvent(GUAPushResult pushResult)
{
string methodTag = "";
if (pushResult.MethodId == (int)GUAMethodID.GUA_PUSH_ADD_LOCAL_NOTIFICATION)
{
methodTag = "AddLocalNotification";
}
else if (pushResult.MethodId == (int)GUAMethodID.GUA_PUSH_CLEAR_LOCAL_NOTIFICATIONS)
{
methodTag = "ClearLocalNotification";
}
else if (pushResult.MethodId == (int)GUAMethodID.GUA_PUSH_NOTIFICATION_CALLBACK)
{
methodTag = "NotificationCallback";
}
Debug.Log(methodTag + pushResult.ToString());
}