Esempio n. 1
0
        //"a4f1f5374957b737f899eb09fa3c3e33cec69ae4e1d603720fda84dbf4ea52ea";//這是(Prod)mibi的Token
        //"ae69b05569f62025adb4def94ce40dead8478a81358c157c163a909ef5049299";//這是Alpha姐的正式iOS裝置TokenID//"14afb410b1c5b254173c24badfcb9c04d5ab0960e384606410b4e10383d1e25b";//"63974870e3c059c8e8dae324d734a87189552d0cab0864b58dd785be299baff6";//"7408e047feed9fff7990d3cc9204fb80f43cf1aeb8268e7d5c3b799737e3e0a6"; ////1002728(iphone6s+ 只能收款)憑證(dev)allpay_apns_dev.p12用的
        //"c1564dd73cd73a003d2ad143d96c9e6d651f8b48b45ba8c0ae9c5db87513fde8";
        //"7408e047feed9fff7990d3cc9204fb80f43cf1aeb8268e7d5c3b799737e3e0a6"; //憑證(prod)aps_production_allpay.p12用的
        //"b25ba4c8b4b01a3a101592615275d7a5a7231a107d6952f4cdd0afa08749bb9d";//1002728(iphone6s+ 只能收款)
        //"f6c0ad4ac5ed95d339af637976efb6df61f3619ed3dd1297fd7e489fe9494766";//1000298(白色小支的iphone--只能付款)
        //  private static string DeviceToken = "64d73e7b0815f7c22d7a412dbde7c4f4477ada6fdc4ee8d57db8ee536706dea6";
        //ref:http://dbhills.blogspot.tw/2015/01/ciosapns.html
        static void Main(string[] args)
        {
            //MID:1002728, Sum:2, MsgID:9257, Subj:【羅小姐】收款成功2元, Title:【羅小姐】收款成功2元, RegID:b25ba4c8b4b01a3a101592615275d7a5a7231a107d6952f4cdd0afa08749bb9d

            /*
             * byte[] b1 = new byte[0];
             * byte[] b2 = new byte[] { };
             * DateTime d = DateTime.Now;
             * DateTime? date1 =  null;
             * DateTime date2 = default(DateTime);
             * var check = (date1 != date2);
             * var check2 = (date2.Equals(date1));
             * int data1 = IPAddress.HostToNetworkOrder(514);
             * byte[] aaa = BitConverter.GetBytes(data1);
             */
            int Count = 23;

            //Timer timer = new Timer(new TimerCallback((object obj) => {
            //int count = (int)obj;
            Count++;
            AppleNotificationPayload payload = new AppleNotificationPayload();

            payload.Alert.Body = String.Format("測試({0})2 By Knock ", DateTime.Now.ToString("yyyy-MM-dd HH:mm"));    //String.Format("Test{0} 使用正式機憑證 + (sandbox.push.apple.com)", Count.ToString("##0"));
            payload.Alert.ActionLocalizedKey = String.Format("mobilepay.security.level_c");
            payload.Badge = Count;
            payload.Sound = "default";


            string json = payload.ToJson();

            Console.WriteLine("Send Json: " + json);

            string sendUTF8Str = SendAPNS(DeviceToken, json);

            Console.WriteLine("" + sendUTF8Str);
            //}), Count,10,2000);

            /*
             * AppleNotificationPayload payload = new AppleNotificationPayload();
             * payload.Alert.Body = "Test13 使用dev憑證 + (gateway.sandbox.push.apple.com)";
             * payload.Badge = 4;
             * payload.Sound = "default";
             *
             *
             * string json = payload.ToJson();
             * Console.WriteLine("Send Json: " + json);
             *
             * string sendUTF8Str = SendAPNS(DeviceToken, json);
             * Console.WriteLine("" + sendUTF8Str);
             */
            Console.ReadKey();
        }
Esempio n. 2
0
        //"c1564dd73cd73a003d2ad143d96c9e6d651f8b48b45ba8c0ae9c5db87513fde8";
        //"7408e047feed9fff7990d3cc9204fb80f43cf1aeb8268e7d5c3b799737e3e0a6"; //憑證(prod)aps_production_allpay.p12用的
        //"b25ba4c8b4b01a3a101592615275d7a5a7231a107d6952f4cdd0afa08749bb9d";//1002728(iphone6s+ 只能收款)
        //"f6c0ad4ac5ed95d339af637976efb6df61f3619ed3dd1297fd7e489fe9494766";//1000298(白色小支的iphone--只能付款)
        //  private static string DeviceToken = "64d73e7b0815f7c22d7a412dbde7c4f4477ada6fdc4ee8d57db8ee536706dea6";
        //ref:http://dbhills.blogspot.tw/2015/01/ciosapns.html
        static void Main(string[] args)
        {
            //MID:1002728, Sum:2, MsgID:9257, Subj:【羅小姐】收款成功2元, Title:【羅小姐】收款成功2元, RegID:b25ba4c8b4b01a3a101592615275d7a5a7231a107d6952f4cdd0afa08749bb9d
            /*
            byte[] b1 = new byte[0];
            byte[] b2 = new byte[] { };
            DateTime d = DateTime.Now;
            DateTime? date1 =  null;
            DateTime date2 = default(DateTime);
            var check = (date1 != date2);
            var check2 = (date2.Equals(date1));
            int data1 = IPAddress.HostToNetworkOrder(514);
            byte[] aaa = BitConverter.GetBytes(data1);
            */
            int Count = 13;
            Timer timer = new Timer(new TimerCallback((object obj) => {
                //int count = (int)obj;
                Count++;
                AppleNotificationPayload payload = new AppleNotificationPayload();
                payload.Alert.Body = String.Format("Test{0} 使用dev憑證 + (gateway.sandbox.push.apple.com)", Count.ToString("##0"));
                payload.Badge = Count;
                payload.Sound = "default";

                string json = payload.ToJson();
                Console.WriteLine("Send Json: " + json);

                string sendUTF8Str = SendAPNS(DeviceToken, json);
                Console.WriteLine("" + sendUTF8Str);
            }), Count,10,2000);
            /*
            AppleNotificationPayload payload = new AppleNotificationPayload();
            payload.Alert.Body = "Test13 使用dev憑證 + (gateway.sandbox.push.apple.com)";
            payload.Badge = 4;
            payload.Sound = "default";

            string json = payload.ToJson();
            Console.WriteLine("Send Json: " + json);

            string sendUTF8Str = SendAPNS(DeviceToken, json);
            Console.WriteLine("" + sendUTF8Str);
             */
            Console.ReadKey();
        }