RSS订阅 | 匿名投稿
您的位置:网站首页 > 组件 > 正文

Delphi 调用极光推送服务端HTTP API实例

作者:admin 来源: 日期:2018/1/9 8:00:22 人气: 标签:idHttp

下面是delphi调用极光推送服务端HTTP API实例
 HttpClient.HandleRedirects := True;
  HttpClient.Request.ContentType := 'application/json';
  HttpClient.Request.BasicAuthentication := True;
  HttpClient.Request.Authentication := TIdBasicAuthentication.Create;
  HttpClient.Request.Authentication.Username := 'appKey';
  HttpClient.Request.Authentication.Password := 'masterSecret';
  messageStr :='{"platform": "all","audience" : "all","notification" : {"alert" : "Hi, JPush for delphi!","android" : {},"ios" : {"extras" : { "newsid" : 321}}}}';
  jsonToSend := TStringStream.Create(messageStr, TEncoding.UTF8);
  jsonToSend.Position := 0;
  Memo1.Text := HttpClient.Post('https://api.jpush.cn/v3/push', jsonToSend);


注:记得在窗体上加上“IdSSLIOHandlerSocketOpenSSL1”
以及idhttp里面IOHandler为“IdSSLIOHandlerSocketOpenSSL1”
不然会报“IOHandler value is not valid.”错误。

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料