private void Update()
{
// no point checking if we don't have a device token yet
if (this.deviceToken == null)
{
return;
}
this.currentQueryTime += Time.deltaTime;
// early out if haven't met the query time
if (this.currentQueryTime < QueryTimerMax)
{
return;
}
// reset timer
this.currentQueryTime = 0.0f;
// https://forum.unity3d.com/threads/using-the-new-notification-system.127016/
if (NotificationServices.remoteNotificationCount != 0)
{
// iterating over all the remote notifications
for (int i = 0; i < NotificationServices.remoteNotificationCount; i++)
{
this.pushHandler.ReceivedPushNotification(NotificationServices.GetRemoteNotification(i).alertBody);
}
// clear all messages
NotificationServices.ClearRemoteNotifications();
NotificationServices.ClearLocalNotifications();
}
}