public override void CancelNotification(int id)
 {
     if (CheckInitialized())
     {
         NotificationTools.CancelNotification(id);
     }
 }
 public override void CancelAllNotifications()
 {
     if (CheckInitialized())
     {
         NotificationTools.CancelAllNotifications();
     }
 }
 public override void ScheduleNotificationRepeating(int firstTriggerInSeconds, int intervalSeconds, string title, string text, int id, IDictionary <string, string> userData, string notificationProfile, int badgeNumber, ICollection <Button> buttons)
 {
     if (CheckInitialized())
     {
         NotificationTools.ScheduleNotificationRepeating(firstTriggerInSeconds, intervalSeconds, title, text, id, userData, notificationProfile);
     }
 }
 public override void PostLocalNotification(string title, string text, int id, IDictionary <string, string> userData, string notificationProfile, int badgeNumber, ICollection <Button> buttons)
 {
     if (CheckInitialized())
     {
         NotificationTools.PostLocalNotification(title, text, id, userData, notificationProfile);
     }
 }
示例#5
0
        public static void Register()
        {
            string taskName = typeof(BackgroundTask).FullName.ToLower();

            if (NotificationTools.IsBackgroundTaskRegistered(taskName))
            {
                return;
            }

            BackgroundTaskBuilder builder = new BackgroundTaskBuilder();

            builder.TaskEntryPoint = typeof(BackgroundTask).FullName;
            builder.Name           = taskName;
            builder.SetTrigger(new MaintenanceTrigger(15, false));

            builder.Register();
        }
        public override bool SetPushNotificationsEnabled(bool enabled)
        {
            if (enabled != pushEnabled)
            {
                pushEnabled = enabled;

                if (enabled)
                {
                    if (Initialized && Settings.Instance.PushNotificationsEnabledWindows)
                    {
                        NotificationTools.EnablePushNotifications(this);
                    }
                }
                else
                {
                    NotificationTools.DisablePushNotifications();
                }
            }

            return(PushNotificationsEnabled());
        }
        //protected
        protected void Update()
        {
            if (!Initialized)
            {
                return;
            }

            if (m_registrationId != null && OnSendRegistrationIdHasSubscribers())
            {
                _OnSendRegistrationId(m_providerName, m_registrationId);
                m_registrationId = null;
            }

            if (Time.time - m_lastTimeUpdated >= m_updateEverySeconds)
            {
                IList <WSA.ReceivedNotification> received;
                WSA.ReceivedNotification         clicked;
                NotificationTools.HandleReceivedNotifications(UnityEngine.WSA.Application.arguments, out received, out clicked);
                if (clicked != null && OnNotificationClickedHasSubscribers())
                {
                    _OnNotificationClicked(WSAReceivedNotificationToReceivedNotification(clicked));
                }

                if (received != null && received.Count > 0 && OnNotificationsReceivedHasSubscribers())
                {
                    List <UTNotifications.ReceivedNotification> receivedNotifications = new List <UTNotifications.ReceivedNotification>();
                    foreach (var it in received)
                    {
                        receivedNotifications.Add(WSAReceivedNotificationToReceivedNotification(it));
                    }

                    _OnNotificationsReceived(receivedNotifications);
                }

                NotificationTools.UpdateWhenRunning();
                m_lastTimeUpdated = Time.time;
            }
        }
 public override void SetNotificationsEnabled(bool enabled)
 {
     NotificationTools.SetNotificationsEnabled(enabled);
 }
 public override bool NotificationsEnabled()
 {
     return(NotificationTools.NotificationsEnabled());
 }
 //public
 public override bool Initialize(bool willHandleReceivedNotifications, int startId, bool incrementalId)
 {
     NotificationTools.Initialize(willHandleReceivedNotifications, startId, incrementalId, this, Settings.Instance.PushNotificationsEnabledWindows && pushEnabled, Settings.Instance.WindowsDontShowWhenRunning, Settings.Instance.PushPayloadTitleFieldName, Settings.Instance.PushPayloadTextFieldName, Settings.Instance.PushPayloadUserDataParentFieldName, Settings.Instance.PushPayloadNotificationProfileFieldName, Settings.Instance.PushPayloadIdFieldName, Settings.Instance.PushPayloadBadgeFieldName);
     Initialized = true;
     return(true);
 }
示例#11
0
 public void Run(IBackgroundTaskInstance taskInstance)
 {
     NotificationTools.Reschedule(false);
 }