Menu

Integration


1. SDK Download

You can download it from here.


2. SDK Import

⚠️ Note: CocosCreator SDK must be used together with the Android or iOS SDK

Description of the downloaded package directory:

Folder Description
Android SDK package required for Android integration
iOS SDK package required for iOS integration
Android_iOS SDK package required for both Android & iOS

Platform directory description:

Folder/File Name Description
Script TypeScript code files to be imported into the Cocos Creator project
bridge/iOS Bridge code files for Xcode project, to be added to your game's Xcode project
bridge/Android Bridge code files for Android Studio project, including source (source dir) and aar package (library dir); choose as needed for your game's Android project

2.1 Android Import Instructions

(1) In the SDK package, select the *_cocosjs_bridge.aar under the Android platform and place it in the project's libs directory, then import it via build.gradle:

gradle Copy
dependencies {
    api fileTree(include: ['*.jar','*.aar'], dir: 'libs')
}

Alternatively, you can use the source code by placing it in the project's src/main/java directory. In this case, you need to add the following ProGuard rules:

text Copy
-keep public class com.**.cocosjs.**
-keepclassmembers class com.**.cocosjs.** {
   public *;
}

(2) Please visit here for more details. For integration instructions, refer to here.

2.2 iOS Import Instructions

(1) Drag the iOSCocosCreatorBridge folder into the file list on the left side of Xcode. In the pop-up dialog, make the following selections (as shown in the figure):

  • Check "Copy items if needed" under Destination
  • Check "Create groups" under Added Folders
  • Check the target(s) you want to add under Add to targets

(2) Please visit here for more details. For integration instructions, refer to here.


3. SDK Initialization

typescript Copy
import {ATSDK} from "db://assets/script/AnyThinkAds/ATSDK";

// ---------------GDPR Initialization Flow start------------------------------
/*ATSDK.getUserLocation(function (userLocation: string | number) {
    if (userLocation === ATSDK.kATUserLocationInEU) {
        if (ATSDK.getGDPRLevel() === ATSDK.UNKNOWN) {
            ATSDK.showGDPRConsent(function () {
                ATSDK.initSDK("your app id", "your app key");
            });
        }
    }
});*/
// ---------------GDPR Initialization Flow end------------------------------

ATSDK.initSDK("your app id", "your app key");

Last modified: 2025-06-04Powered by