Log In
You can then view all documents
Installation/Android/Initialize CSJ SDK
Initialize CSJ SDK
Last updated 2022-06-28 16:35:44

SDK Initial configuration

Initial configuration


  1. The CSJ SDK needs to be initialized in the main thread
  2. Multi-process involves the use of WebView. If users want to use their own data path, they can call WebView.setDataDirectorySuffix() before the SDK is initialized.
    Developers need to call the following code after the user agrees to the privacy policy then to initialize the CSJ SDK.
    Important: At present, the SDK supports multiple processes. If it is clear that a certain process will not use the advertising SDK, you can initialize the advertising SDK only for a specific process

Initialization interface description

SDK initialization of 3450 and above

Adjustment instructions:

CSJ has made major changes to the SDK initialization method in version 3450, supporting both synchronous initialization and asynchronous initialization, and the asynchronous initialization API supported in TTAdConfig.Builder will no longer take effect. After optimization, there is no significant difference in time consumption between synchronous initialization and asynchronous initialization. The latter puts part of the initialization logic in the child thread. If developers use the asynchronous initialization method, please note that they need to request advertisements after the success callback.
Add initialization interface
Important note: If you are accessing the CSJ Pro version of the SDK, you can only use asynchronous initialization. At the same time, the obfuscation rules should be adjusted simultaneously

CSJ SDK initialization API: This API must be called in the main thread, and the CSJ will execute the initialization operation in the child thread.


Fail callback status code

Document version

Revision date


Initialization error code caused by local execution API error

Initialization state interface


Adjust API
CSJ SDK initialization method: The API is adjusted to be called in the main thread, and the initialization operation will be executed in the main thread.


Expired & invalid API


SDK initialization method below 3450

Note: AppId is required. If the appid is sent through the server, you need to make a judgment if it is not empty before initialization.


Privacy information control switch




-Need to set isCanUseLocation() before overriding getTTLocation()
-You need to set isCanUsePhoneState() before overriding getDevImei()

Construct TTAdManager object
The TTAdManager object is the entry interface of the entire SDK, which can be used for advertisement acquisition, permission request, version number acquisition, etc.
Construction method


TTAdManger interface description


Points to note when importing SDK:

  • TTAdManagerHolder maintains singleton mode;
  • The SDK is initialized multiple times in a single process based on the information of the first initial setting;
  • appId is a 7-digit `character generated by the wearing app on the platform;
  • Any type of video ad loading and a black screen appears after loading, you can try to solve the problem in the following ways:
  • Whether to add the black screen permission in the manifest file
  • Try to use the TextureView control to play the video
  • AppName is not empty. It is recommended to be consistent with the application name created by the platform
  • DirectDownloadNetworkType configuration: Can be configured according to specific product requirements, the network set in the method is the network that allows direct download If you need to have a confirmation pop-up window for downloading under any network, just write blank (not null) in the method
  • Description of supportMultiProcess: If the project is a single process, it must be changed to false If the project is multi-process, you need to set true. If you need to display ads in each process in multi-process, you must initialize the SDK in each process If your application needs to support multiple processes, be sure to set TTAdConfig.supportMultiProcess(true). Confirm the app multi-process support judgment method: CSJ sdk initialization Acquisition of CSJ advertisements CSJ advertising display The calls of these three key points are multi-process in different processes, otherwise they are single-process If not necessary, try not to use multi-process switch, multi-process efficiency is not as high as single process
  • Provider configuration
  • Both single process and multiple processes must be configured with providers required by CSJ
  • The provider needs to be configured regardless of whether the platform application is in a test state or an official state
  • In order not to affect the conversion and revenue of ads, please be sure to configure xxx.TTMultiProvider in the manifest file
  • If your application also obfuscates resources (such as andResGuard), please don t obfuscate any resources of CSJ to prevent the problem of crashing due to missing resources.
  • The resources on the whiteList.txt whitelist in the SDK compressed file do not support obfuscation. Developers need to recheck the whitelist content during the SDK update iteration process.

Contact us