Ejemplo n.º 1
0
        public async void OnFeedbackNotified(object sender, FeedbackNotifyEventArgs args)
        {
            string Google_App_ID = "AIzaSyBJG69jVZWgFt7ayf-FC3Wervecxfjm0Dg";
            string Sender_ID     = "AIzaSyBJG69jVZWgFt7ayf-FC3Wervecxfjm0Dg";
            string contentTitle  = args.NotificationMessage.Body;
            string reciever      = args.NotificationMessage.DeviceId;
            string view;

            if (args.NotificationMessage.For.Equals(Constants.ROLE_HR))
            {
                reciever = "/topics/HR";
                view     = args.NotificationMessage.Status.Equals(Constants.OPEN) ? Constants.OPEN : Constants.RESPONDED;
            }
            else if (args.NotificationMessage.For.Equals(Constants.ROLE_USER))
            {
                view = Constants.CLOSED;
            }
            else
            {
                view = Constants.ASSIGNED;
            }


            var postData = new
            {
                to                = reciever,
                priority          = "high",
                content_available = true,
                notification      = new
                {
                    body  = contentTitle,
                    title = args.NotificationMessage.Title,
                    badge = 1,
                    //click_action = view
                },
                data = new
                {
                    showView = view,
                    id       = args.NotificationMessage.FeedbackId,
                }
            };

            string postbody = JsonConvert.SerializeObject(postData).ToString();
            string response = await SendGCMNotification(Google_App_ID, Sender_ID, postbody);
        }
Ejemplo n.º 2
0
        public async void OnFeedbackNotified(object sender, FeedbackNotifyEventArgs args)
        {
            Debug.Print("-----------in notificationbroadcasting message-------");
            string Google_App_ID = "AIzaSyBJG69jVZWgFt7ayf-FC3Wervecxfjm0Dg";
            string Sender_ID     = "AIzaSyBJG69jVZWgFt7ayf-FC3Wervecxfjm0Dg";
            string contentTitle  = args.Feedback.title;
            var    postData      = new
            {
                to                = "/topics/HR",
                priority          = "high",
                content_available = true,
                notification      = new
                {
                    body  = contentTitle,
                    title = "Ticket Raised",
                    badge = 1
                },
            };

            string postbody = JsonConvert.SerializeObject(postData).ToString();
            string response = await SendGCMNotification(Google_App_ID, Sender_ID, postbody);
        }