Skip to main content

SDK Initialization

Before creating any ad slot object, you must first call to initialize the TradPlus SDK.

API Description#

  • Initialize TradPlus in main.dart:Otherwise, the backend cannot accurately count DAU。
MethodDescription
TPSDKManager.init("appId")appId:Application ID created in the TradPlus backend。
Get the location in the TradPlus backendApplication Management -> Applications, Advertisement Positions -> Applications Added by Developers

Other API Descriptions#

  • Both need to be called before init SDK
MethodDescription
TPSDKManager.setInitListener(TPInitListener listener);Set initialization listener, set before initializing SDK.
initFinish: Return true, indicating successful initialization.
It is recommended to request ads after successful initialization.
Map settingMap = {"oaid","oaid obtained by the developer"};
TPSDKManager.setSettingDataParam(settingMap);
Set the global OAID before requesting an advertisement.
Supported since V10.2.0.1 (Android only).

Code Sample#

listener = TPInitListener(
initFinish: (bool finish) {
//Initialization is successful. It is recommended to request an ad after initialization is successful.
});
//Set initialization listener
TPSDKManager.setInitListener(listener!);
//Initialize SDK, appId is the application ID created by TradPlus backend
TPSDKManager.init("appId");