Esempio n. 1
0
        public FCMDataPayloadSection(String titleArg, String contentArg, PushMessageDataPayloadTypeEnum typeArg, int msgIndex)
        {
            msg_index   = msgIndex.ToString();
            _type       = typeArg;
            title       = titleArg;
            content     = contentArg;
            type        = typeArg.ToString();
            dry_run     = "true";
            DataSection = new Dictionary <String, String>();

            if (String.IsNullOrEmpty(registration_ids) == false)
            {
                DataSection.Add("registration_ids", registration_ids);
            }

            if (String.IsNullOrEmpty(to) == false)
            {
                DataSection.Add("to", to);
            }

            if (String.IsNullOrEmpty(title) == false)
            {
                DataSection.Add("title", title);
            }

            if (String.IsNullOrEmpty(content) == false)
            {
                DataSection.Add("content", content);
            }

            if (String.IsNullOrEmpty(type) == false)
            {
                DataSection.Add("type", type);
            }

            if (String.IsNullOrEmpty(dry_run) == false)
            {
                DataSection.Add("dry_run", dry_run);
            }

            if (String.IsNullOrEmpty(imageurl) == false)
            {
                DataSection.Add("imageurl", imageurl);
            }

            if (String.IsNullOrEmpty(bigImageurl) == false)
            {
                DataSection.Add("bigImageurl", bigImageurl);
            }

            if (String.IsNullOrEmpty(msg_index) == false)
            {
                DataSection.Add("msg_index", msg_index);
            }
        }
Esempio n. 2
0
        public FCMData(int tenantId, String serverKey, String tokenId, String title, String content, PushMessageDataPayloadTypeEnum type, int msgIndex)
        {
            fcmMessage = new Message();
            fcmMessage.RegistrationIds = new List <String>()
            {
                tokenId
            };
            TenantId = tenantId;

            var data = new FCMDataPayloadSection(title, content, type, msgIndex);

            string json = JsonConvert.SerializeObject(data);

            fcmMessage.Data = data.DataSection;
        }
Esempio n. 3
0
        public PushMessageData(int tenantId, int numOfUsersIdPerMessage, String title, String content, PushMessageDataPayloadTypeEnum type, int msgIndex)
        {
            TenantId = tenantId;


            var data = new FCMDataPayloadSection(title, content, type, msgIndex);

            data.SetLongText("This is my long text");

            long[] ids    = new long[numOfUsersIdPerMessage];
            long   currId = 1000000;

            for (int i = 0; i < numOfUsersIdPerMessage; i++)
            {
                ids.SetValue(currId, i);
                currId++;
            }
            data.SetCustomerIdsAsRegistrationIds(ids);

            DataPayload = JsonConvert.SerializeObject(data.DataSection);
        }