Example #1
0
        private static void ExecuteBatchPushExample()
        {
            SinglePayload singlePayload = new SinglePayload()
            {
                Platform = new List <string> {
                    "android", "ios"
                },
                Target       = "flink",
                Notification = new Notification
                {
                    Alert   = "hello jpush",
                    Android = new Android
                    {
                        Alert = "android alert",
                        Title = "title"
                    },
                    IOS = new IOS
                    {
                        Alert = "ios alert",
                        Badge = "+1"
                    }
                },
                Message = new Message
                {
                    Title   = "message title",
                    Content = "message content",
                    Extras  = new Dictionary <string, string>
                    {
                        ["key1"] = "value1"
                    }
                },
                Options = new Options
                {
                    IsApnsProduction = true // 设置 iOS 推送生产环境。不设置默认为开发环境。
                }
            };
            List <SinglePayload> singlePayloads = new List <SinglePayload>();

            singlePayloads.Add(singlePayload);
            Console.WriteLine("start send");
            var response = client.BatchPushByAlias(singlePayloads);

            Console.WriteLine(response.Content);
        }