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

标签 c# parse-platform push-notification

我打算到时候推送消息,这正是我想要的,但我不知道该怎么做。

现在,我可以将消息发送到 ios 或 Android。

这是我的代码,请帮我把时间加进去。

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

最佳答案

C# 中的最终解决方案。

我使用 Rest 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();

关于c# - 如何添加时间以使用 .Net(C#) 发送 API 推送消息 (parse.com),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31153589/

相关文章:

c# - unity StopCoroutine 存在多层(或嵌套)时不停止协程 "yield return"

c# - 分配给 IList< > 或 List< >?

ios - 推送通知未在后台接收但在前台工作

ios - 在 iPhone 上接收推送通知

ios - APS 缺少权利

SUDS 的 C# 版本?

c# - 如何检索USB设备的名称

ios - PF按日期查询

ios - 如何在 ios 中使用 PFInstallation 获取在解析中注册的所有用户

swift - 解析 : loadObjects/refreshing the tableview after a pull to refresh