简体   繁体   English

如何使用.Net(C#)增加时间发送API推送消息(parse.com)

[英]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. 现在,我可以将消息发送到ios或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#. C#中的最终解决方案。

I use Rset Api to do what I want. 我用Rset Api做我想做的事。

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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