<dependency><groupId>io.github.tpnsPush</groupId><artifactId>xinge</artifactId><version>1.2.4.11</version></dependency>
XingeApp xingeApp = new XingeApp.Builder().appId(appid).secretKey(secretKey).domainUrl(“https://api.tpns.tencent.com/”).build();PushAppRequest pushAppRequest = new PushAppRequest();//完善PushAppRequest 消息...JSONObject ret = xingeApp.pushApp(pushAppRequest );
XingeAppSimple
中包含推送、绑定、解绑等接口的示例。public JSONObject pushTokenAndroid() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.token);pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("title");message.setContent("content");pushAppRequest.setMessage(message);MessageAndroid messageAndroid = new MessageAndroid();message.setAndroid(messageAndroid);ArrayList<String> tokenList = new ArrayList();tokenList.add("04cac74a714f61bf089********63d880993");pushAppRequest.setToken_list(tokenList);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushAccountAndroid() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.account);pushAppRequest.setPlatform(Platform.android);pushAppRequest.setMessage_type(MessageType.notify);pushAppRequest.setAccount_push_type(1);Message message = new Message();message.setTitle("title");message.setContent("content");MessageAndroid messageAndroid = new MessageAndroid();message.setAndroid(messageAndroid);pushAppRequest.setMessage(message);ArrayList<String> accountList = new ArrayList();accountList.add("123");pushAppRequest.setAccount_list(accountList);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushTagAndroid() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.tag);pushAppRequest.setPlatform(Platform.android);pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("title");message.setContent("content");MessageAndroid messageAndroid = new MessageAndroid();message.setAndroid(messageAndroid);pushAppRequest.setMessage(message);ArrayList<String> tagList = new ArrayList();tagList.add("tag");TagListObject tagListObject = new TagListObject();tagListObject.setTags(tagList);tagListObject.setOp(OpType.OR);pushAppRequest.setTag_list(tagListObject);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushAllAndroid() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.all);pushAppRequest.setPlatform(Platform.android);pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("title");message.setContent("content");MessageAndroid messageAndroid = new MessageAndroid();message.setAndroid(messageAndroid);pushAppRequest.setMessage(message);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushTokenIos(){PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.token);pushAppRequest.setEnvironment(Environment.valueOf("dev"));pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("title");message.setContent("content");MessageIOS messageIOS = new MessageIOS();Alert alert = new Alert();Aps aps = new Aps();aps.setAlert(alert);messageIOS.setAps(aps);message.setIos(messageIOS);pushAppRequest.setMessage(message);ArrayList<String> tokenList = new ArrayList<String>();tokenList.add("0250df875c93c55********536b54fc1c49f");pushAppRequest.setToken_list(tokenList);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushAccountIos() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.account);pushAppRequest.setEnvironment(Environment.valueOf("dev"));pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("账号推送");message.setContent("content");MessageIOS messageIOS = new MessageIOS();Alert alert = new Alert();Aps aps = new Aps();aps.setAlert(alert);messageIOS.setAps(aps);message.setIos(messageIOS);pushAppRequest.setMessage(message);ArrayList<String> accountList = new ArrayList();accountList.add("1122");pushAppRequest.setAccount_list(accountList);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushTagIos() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.tag);pushAppRequest.setEnvironment(Environment.valueOf("dev"));pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("标签推送");message.setContent("content");MessageIOS messageIOS = new MessageIOS();Alert alert = new Alert();Aps aps = new Aps();aps.setAlert(alert);messageIOS.setAps(aps);message.setIos(messageIOS);pushAppRequest.setMessage(message);ArrayList<String> tagList = new ArrayList();tagList.add("1122");TagListObject tagListObject = new TagListObject();tagListObject.setTags(tagList);tagListObject.setOp(OpType.OR);pushAppRequest.setMessage(message);pushAppRequest.setTag_list(tagListObject);return this.xingeApp.pushApp(pushAppRequest);}
public JSONObject pushAllIos() {PushAppRequest pushAppRequest = new PushAppRequest();pushAppRequest.setAudience_type(AudienceType.all);pushAppRequest.setEnvironment(Environment.valueOf("dev"));pushAppRequest.setMessage_type(MessageType.notify);Message message = new Message();message.setTitle("全量推送");message.setContent("content");MessageIOS messageIOS = new MessageIOS();Alert alert = new Alert();Aps aps = new Aps();aps.setAlert(alert);messageIOS.setAps(aps);message.setIos(messageIOS);pushAppRequest.setMessage(message);return this.xingeApp.pushApp(pushAppRequest);}
{"result":"{}","environment":"","push_id":"1328245138690125824","err_msg":"NO_ERROR","err_msg_zh":"","ret_code":0,"seq":0}
Peer certificate cannot be authenticated with given CA certificates
,如何解决?# openssl x509 -in signed.crt -noout -dates
signed.crt
修改为您自己服务端上的证书名称。
本页内容是否解决了您的问题?