Quick Integration with Android

Last updated: 2020-12-03 14:49:11


    This document describes how to quickly integrate TPNS into your Android application. You can use the TPNS service on your application in just three steps.

    Preparing for Integration

    1. Before integrating the SDK, you need to log in to the TPNS Console and create the product and Android application. For detailed directions, please see Creating Products and Applications.
    2. Then go to the application's Configuration Management page to prepare for the integration.

    Step 1: start integration

    1. On the Configuration Management page, click Quick Integration.

    2. Complete the configuration as instructed in the integration guide and click Click to verify.

    3. If the following prompt is displayed, the SDK has been successfully integrated.

      • If the following prompt is displayed, please check whether you have applied for a free trial or purchased the push service for the application.

        You can view the current application service status on the Product Management page. The service will be activated 30 minutes after you apply for a free trial or purchase the service.

      • If the following prompt is displayed, please check whether the application has been successfully registered with the push service as instructed in verifying integration result.

    Step 2: verify integration result

    1. Run the application, filter logs by the "TPush" keyword, and view the displayed logs.

      If a log similar to that shown in the preceding figure is displayed, the TPNS SDK has been successfully integrated as a plugin.
    2. The log of a successful registration with the push service is as shown below:
      XG register push success with token:6ed8af8d7b18049d9fed116a9db9c71ab4aabb65
      If the token cannot be found, please check the error code returned by the registration API and troubleshoot as instructed in Error Code.

    Step 3: quickly integrate with vendor channel

    1. On the Configuration Management page, enable the vendor push channel and configure the application information such as AppId and SecretKey. For more information about how to apply for such information, see the documentation of the vendor channel.
      • Click View Documentation to see the vendor channel description.
      • Configure the vendor channel at AppId, AppKey, and AppSecret on the right.
    2. After configuring the vendor channel information, click Download Configuration Files at the top of the page to download the vendor channel configuration file and use it to replace the legacy one in the project file.


    1. View plugin logs.
      If an exception occurs during integration, set the debug field in the tpns-configs.json file to true and run the following command:
      ./gradlew --rerun-tasks :app:processReleaseManifest 
      Then, use the TpnsPlugin keyword for analysis.
    2. Click sync projects.
    3. Check whether there are relevant dependencies in the External Libraries of the project.
    4. If the log displays Execution failed for task ':Paracraft:checkTPNS', the TPNS Android SDK can be upgraded to a new version. If you do not want to check for updates, add "upgrade": false to the tpns-configs.json file, as shown below:

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback