简体   繁体   中英

How do I add time to send API push message (parse.com) using .Net(C#)

I am going to push the message at the time which is exactly what I want,but I don't know how to do that.

Now,I can send the message to ios or Android.

There is my code.Please help me to add the time in that.

ParseClient.Initialize("XXXXXXXXX", "XXXXXXXXXXXXXXX");               

            var push = new ParsePush();
            if (!string.IsNullOrWhiteSpace(Id))
            {
                push.Query = from install in ParseInstallation.Query
                             where install.Get<string>("NO") == Id
                             select install;
            }                
            push.Data = new Dictionary<string, object> {
              {"title", TitleMeg},
              {"alert", AlertMeg}
            };
            await push.SendAsync();

The final solution in C#.

I use Rset Api to do what I want.

WebRequest request = WebRequest.Create("https://api.parse.com/1/push");

request.ContentType = "application/json";
request.Method = "POST";
request.Headers["X-Parse-Application-Id"] ="";
request.Headers["X-Parse-REST-API-Key"] = "";
string json = json格式參考-d中的欄位 https://parse.com/docs/rest/guide#push-notifications-scheduling-pushes
byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes(json);
string result = System.Convert.ToBase64String(buffer);
Stream reqstr = request.GetRequestStream();
reqstr.Write(buffer, 0, buffer.Length);
reqstr.Close();

WebResponse response = request.GetResponse();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM