Menu

Import and configure

1. SDK Description

TopOn Cocos2dx version SDK is a re-encapsulated version based on the Android and iOS versions of TopOn. It is convenient for developers based on the Cocos2d environment to integrate and use. Supported advertising forms include rewarded video ads, interstitial ads, banners ads  native ads.

2. Integrated reference configuration

2.1 File Description

FileDescriptionRequired
Classes/bridgeIt includes the calling interface classes and callback interfaces that the SDK needs to use. For details, see Description belowY
bridge_iosDetailed implementation of the iOS version SDK conversion interfaceY
bridge_android/jniSpecific JNI implementation of the Android SDK conversion interfaceY
bridge_android/sourceAndroid version Java implementation of SDK conversion interfaceY

2.2 General integrated environment configuration instructions (required)

1. Cocos2dx SDK only provides C++ and bridge files, please download the iOS native SDK (iOS download) or Android native SDK (Android download);

2.3 iOS integrated environment configuration instructions

1. Drag the files in the bridge directory in Classes into the Classes group of Xcode;
2 Copy bridge_ios to the project proj.ios_mac/ios directory, and drag the content into the ios group of Xcode;

Specific xcode environment For configuration and framework reference, Please refer to the iOS help document

2.4 Android integrated environment configuration instructions

1. Change the Configure the files in the bridge directory and bridge_android/jni to CMakeList.txt, so that the project can import the .cpp and .h files;
2. The java code in the bridge_android/source/com/anythink/cocos2dx/bridge directory (including the entire path directory) to the game's android project /app/src

Specific Android Studio environment configuration and AAR library reference, Please refer to the Android help documentation

3. Splash ad instructions

It is strongly recommended to use the native API (Objective-C / Java) in Xcode/Android Studio to access. For more information on how to integrate open-screen ads using Objective-C / Java, please refer to the TopOn SDK integration documentation

System platformDescription
TopOn Android SDKView
TopOn iOS SDKView

Specific calling examples are as follows:
iOS:

[[ATAdManager sharedManager] loadADWithPlacementID:@"your ad placement id" 
extra:@{kATSplashExtraTolerateTimeoutKey:@5.0} delegate:self window:window containerView:nil];

The window in iOS can be displayed directly using the windonw in the AppController class

Android: You need to create an Activity in the application. For detailed demo, you can view: proj.android/app/src/org.cocos2dx.cpp/SplashActivity

new ATSplashAd(this, container, placementId, listener);


Last modified: 2025-05-30Powered by