![](/img/trans.png)
[英]How do I send API credentials and username / password with .Net / Parse.com? (PHP to C#)
[英]How do I add time to send API push message (parse.com) using .Net(C#)
我正要在那時發布消息,而這正是我想要的,但是我不知道該怎么做。
現在,我可以將消息發送到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#中的最終解決方案。
我用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.