API (java)

Last updated: 2020-05-13 18:13:11


SDK Description

This SDK provides the Java package of the TPNS server APIs and communicates with the TPNS backend. You can import the XingeApp package when using it. This SDK mainly encapsulates v3 APIs related to push.

Integration Steps

Import Maven dependencies:
Resource library configuration:


Dependency configuration



XingeApp API description

This class provides APIs for interaction with the TPNS backend and constructed by XingeApp.Builder with the following parameters:

Parameter Name Type Required Default Value Description
appId int Yes None Push target accessID (which is a 10-digit number starting with 1500 for Android or 1600 for iOS)
secretKey String Yes None Push key
proxy Proxy No Proxy.NO_PROXY This parameter can be set if a proxy needs to be configured
connectTimeOut int No 10s Connection timeout period
readTimeOut int No 10s Request timeout period
domainUrl String No https://openapi.xg.qq.com/ API request service domain name address, which is the TPNS API address by default and should be changed to https://api.tpns.tencent.com/ during use


XingeApp xingeApp = new XingeApp.Builder()

PushAppRequest pushAppRequest = new PushAppRequest();
// Complete the `PushAppRequest` message
JSONObject ret =  xingeApp.pushApp(pushAppRequest );

pushAppRequest API description

This class provides an encapsulated push message body. For the description and usage of parameters, please see Push API Description.

Server Return Code

For the meaning of ret_code, please see Server Error Codes.