Esempio n. 1
0
        /**
         * You may call NotificationServices Manually
         */
        public static PushNotification pullMessage(int position)
        {
            PushNotification push = new PushNotification();

            push.message  = NotificationServices.GetRemoteNotification(position).alertBody;
            push.sound    = NotificationServices.GetRemoteNotification(position).soundName;
            push.tag      = NotificationServices.GetRemoteNotification(position).userInfo.ToString();
            push.userInfo = NotificationServices.GetRemoteNotification(position).userInfo;
            return(push);
            //NotificationServices.GetRemoteNotification(position).alertBody;
        }
        private static List <Dictionary <string, object> > GetRemoteNotifications()
        {
            List <Dictionary <string, object> > result = new List <Dictionary <string, object> >();

            if (NotificationServices.remoteNotificationCount > 0)
            {
                for (int r = 0; r < NotificationServices.remoteNotificationCount; r++)
                {
                    RemoteNotification remoteNotification = NotificationServices.GetRemoteNotification(r);
                    result.Add(new Dictionary <string, object>()
                    {
                        { "message", remoteNotification.alertBody },
                        { "payload", remoteNotification.userInfo }
                    });
                }
                NotificationServices.ClearRemoteNotifications();
                if (GamedoniaPushNotifications.notificationType == RemoteNotificationType.Badge)
                {
                    ClearBadge();
                }
            }

            return(result);
        }