Skip to main content

Cocos Creator

Download the SDK

First, you need to download Yodo1Ads.ts and add it to your project. Once done, create a new Node and drop Yodo1Ads.ts script on it.

Setup Gradle

  1. Go to Project > Build and click on the Build button. Then open the generated folder in Android Studio: your_project_folder/build/jsb-default/frameworks/runtime-src/proj.android-studio

  2. Once the project is opened in Android Studio, and add the repositories to build.gradle project level.

    allprojects {
    repositories {
    google()
    jcenter()
    mavenCentral()
    maven { url 'https://artifact.bytedance.com/repository/pangle' }
    maven { url 'https://android-sdk.is.com' }
    maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
    maven { url "https://artifactory.bidmachine.io/bidmachine" }
    }
    }
  3. Add the MAS dependency in build.gradle app level

    implementation 'com.yodo1.mas:full:4.12.0'
  4. Add Multidex in the defaultConfig section in build.gradle app level

    multiDexEnabled true
  5. Add the following lines in gradle.properties. And set PROP_MIN_SDK_VERSION to 21.

    android.useAndroidX=true
    android.enableJetifier=true
    android.enableDexingArtifactTransform=false
    org.gradle.daemon=true
    org.gradle.jvmargs=-Xmx2560m
  6. Add our proguard content to your proguard file.

Native Code Configuration

  1. Add your Admob ID
  • Add your AdMob ID to your app’s AndroidManifest.xml file.

  • Your Admob ID can be found under the "details" of your app on MAS Dashboard.

  • Please replace YOUR_ADMOB_ID with your own Admob ID.

    <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="Your_Admob_ID"
    />
  1. Add Yodo1Ads.java file in the same directory as AppActivity.java.

  2. Add the following code to AppActivity.java:

    public static void initializeSdk(String appKey,boolean isEnabled)
    {
    Yodo1Ads.initializeSdk(activity, appKey,isEnabled);
    }

    public static void loadBannerAds(String size,String horizontal,String Vertical)
    {
    Yodo1Ads.loadBannerAds(size,horizontal,Vertical);
    }

    public static void hideBannerAds()
    {
    Yodo1Ads.hideBannerAds();
    }

    public static void showBannerAds()
    {
    Yodo1Ads.showBannerAds();
    }

    public static void initializeInterstitialAds()
    {
    Yodo1Ads.initializeInterstitialAds();
    }

    public static void showInterstitialAds()
    {
    Yodo1Ads.showInterstitialAds();
    }

    public static void initializeRewardAds()
    {
    Yodo1Ads.initializeRewardAds();
    }

    public static void showRewardAds()
    {
    Yodo1Ads.showRewardAds();
    }

    public static void setCOPPA(boolean isEnabled)
    {
    Yodo1Ads.setCOPPA(isEnabled);
    }

    public static void setGDPR(boolean isEnabled)
    {
    Yodo1Ads.setGDPR(isEnabled);
    }

    public static void setCCPA(boolean isEnabled) {
    Yodo1Ads.setCCPA(isEnabled);
    }
  3. Create an AppActivity static object in AppActivty.java and make sure to set AppActivity to the current instance.

Next Steps