This document describes how to quickly integrate TPNS into your Android application. You can use the TPNS service on your application in just four steps.
Preparing for Integration
- 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.
- After completing the above steps, enter the application's Configuration Management page to prepare for the integration.
- On the Configuration Management page, click Quick Integration.
- Complete the configuration as instructed in the integration guide and click "Verify".
- If the following prompt is displayed, the SDK is successfully integrated.
- If the following prompt is displayed, please check whether the trial has been activated or whether the push service has been purchased 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 the 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.
Verifying Integration Result
Run the application, filter logs by the "TPush" keyword, and view the displayed logs:
If a log similar to the one above is displayed, the TPNS SDK has been successfully integrated as a plugin.
The log of successful registration with the push service is as shown below:
XG register push success with token:6ed8af8d7b18049d9fed116a9db9c71ab44d5565
If the token cannot be found, please check the error code returned by the registration API and troubleshoot as instructed in Error Codes
Quickly Integrating with Vendor Channel
- On the configuration management page, enable the vendor push channel and configure application information such as
SecretKey. For more information on how to apply for such information, please see the relevant documentation of the corresponding vendor.
- After configuring the vendor channel information, click Download Configuration File at the top to download the vendor channel configuration file and use it to replace the legacy one in the project file.
- 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:
Then, use the
./gradlew --rerun-tasks :app:processReleaseManifest
"TpnsPlugin" keyword for analysis.
- Sync projects.
- Check whether there are relevant dependencies in the External Libraries of the project.