Skip to main content

SDK Initialization

Before creating any advertising slot object, you must first call the initialization TradPlus SDK.

API#

  • Initialize TradPlus in the game startup class: otherwise the background cannot accurately count DAU.
MethodDescription
TradplusAds.Instance().InitSDK("appId")appId:The application ID created by TradPlus background. Just call it once.
Get the location in TradPlus backend Apps & Ad Units -> Add App
  • Callback
MethodParameterDescription
TradplusAds.Instance().OnInitFinishbool successInitialization end callback.
success:Whether the initialization is successful, true means the initialization is successful.

Other API#

MethodDescription
TradplusAds.Instance().SetCustomMap(Dictionary customMap)Set global traffic grouping.
Called before initializing the SDK.
Dictionary<string, object> settingMap = new Dictionary<string, object>();
settingMap.Add("oaid","oaid obtained by the developer");
TradplusAds.Instance().SetSettingDataParam(settingMap);
Set global OAID.
Called before requesting an ad.
V10.2.0.1 starts to support (Android only)

Code Example#

using TradplusSDK.Api;
void Start()
{
// Add initialization callback monitoring
TradplusAds.Instance().OnInitFinish += OnInitFinish;
// Set traffic grouping data
Dictionary<string, string> customMap = Configure.Instance().MainCustomMap;
TradplusAds.Instance().SetCustomMap(customMap);
//Initialize SDK
TradplusAds.Instance().InitSDK(appId);
}
void OnInitFinish(bool success)
{
// Initialization is complete, it is recommended to request advertisements after this callback
}
// Remove listening
TradplusAds.Instance().OnInitFinish -= OnInitFinish;

Privacy Policy Settings#

For relevant privacy policy settings, please refer to the following documents: