XingeApp
package. This SDK mainly encapsulates push-related V3 APIs.<dependency><groupId>io.github.tpnsPush</groupId><artifactId>xinge</artifactId><version>1.2.4.11</version></dependency>
groupId
changes since version 1.2.4.11.XingeApp.Builder
with the following parameters:Parameter | Type | Required | Default Value | Description |
appId | String | Yes | Empty | |
secretKey | String | Yes | Empty | Push key, which can be obtained on the Product Management > Configuration Management > Basic Configuration page. |
proxy | Proxy | No | Proxy.NO_PROXY | This parameter can be set if a proxy needs to be configured. |
connectTimeOut | Integer | No | 10s | Connection timeout period. |
readTimeOut | Integer | No | 10s | Request timeout period. |
domainUrl | String | No | https://openapi.xg.qq.com/ | API request service domain name address, which is the XG API address by default. Change the value to the service URL corresponding to your service access point. |
XingeApp xingeApp = new XingeApp.Builder().appId(appid).secretKey(secretKey).domainUrl("https://api.tpns.tencent.com/").build();PushAppRequest pushAppRequest = new PushAppRequest();// Complete the `PushAppRequest` message...JSONObject ret = xingeApp.pushApp(pushAppRequest );
XingeAppSimple
class provides API examples related to message push, account binding and unbinding, etc.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("Account push");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("Tag push");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("Full push");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}
AccessID
matches with SecretKey
, and whether domainUrl
corresponds to the service access point of the application.Peer certificate cannot be authenticated with given CA certificates
?openssl
command to view the expiration time:# openssl x509 -in signed.crt -noout -dates
signed.crt
with the name of the certificate on your server.
Was this page helpful?