Cocos2dx SDK Integration

Before you begin:

Requirements and Optional Permissions

  • The GameADzone SDK requires API level 19 (Android OS 4.4) or higher.
  • Required permission: android.permission.INTERNET
  • Required permission: android.permission.WAKE_LOCK
  • Required permission: com.google.android.gms.permission.AD_ID

Add GameADzone .aar and dependencies to your Gradle file.

dependencies {
      
     implementation 'com.google.android.gms:play-services-ads:21.1.0'
     implementation 'com.android.installreferrer:installreferrer:2.2'
     implementation files ('/Users/Desktop/Gazsdk/GazLibrary-release.aar')
     def lifecycle_version = "2.0.0"
     implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
     implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
     annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"

}

Add the following code to your ProGuard configuration.

-keep class com.sdk.gameadzone.** { *; }
-dontwarn com.sdk.gameadzone.** 

Add the Google Play Services Library as a dependency of your project.

  • The Google Play Services library has its own set of integration instructions, including additions to your Android Manifest and ProGuard configuration.
  • Follow these setup instructions from Google.
  • Note: Use Google Mobile Ads SDK 20.0.0 OR Higher

Add the following entry in your AndroidManifest.xml file.

<activity
    android:name="com.sdk.gameadzone.GameADzoneActivity"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:screenOrientation="portrait"
    android:configChanges="orientation|keyboardHidden|screenSize"/>

      If You are using Gameadzone mediation with admob
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="Admob App ID"/>

Import the GameADzone SDK into any activity that uses GameADzone.

import com.sdk.gameadzone.GameADzone;
import com.sdk.gameadzone.GameADzoneBannerAdListener;
import com.sdk.gameadzone.GameADzoneInterstitialAdListener;
import com.sdk.gameadzone.GameAdzoneRewardAdListener;

Initialize GameAdzone SDK

GameADzone.InitializeSDK(this,"ANQSSXCMC0YSNI6");

If You are using Gameadzone mediation with admob
MobileAds.initialize(this, new OnInitializationCompleteListener() {
    @Override
    public void onInitializationComplete(InitializationStatus initializationStatus) {
    }
});

Add GameAdzone classes into Classes folder

 #include "GameAdzone.hpp" 

To show a static or video Banner Ad

GameAdzone::showBannerAdsTop();
GameAdzone::showBannerAdsBottom();

//To Hide Banner Ad
GameAdzone::hideBannerAds();

To show interstitial ad:

GameAdzone::showInterstitialAds();

To show MoreApp

GameAdzone::showMoreApps();

To Show Medium Rectangle Banner Ad(300*250 Fix size)

For Portrait
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Portrait_Top);
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Portrait_Center);
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Portrait_Bottom);

For landscape
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Landscape_Right);
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Landscape_Center);
GameAdzone::showRectangleBanner(GameAdzone::rectangleBannerPostion::Landscape_Left);

To Show Reward Video

GameAdzone::showRewardAds();

-In your Header file(.h/.hpp) add 3 callback method


virtual void onRewardAdLoaded();
virtual void onRewardAdFailedToLoad();
virtual void onUserEarnedReward();

-In you class file(.cpp) declare call back method


void ClassName::onRewardAdLoaded(){
    CCLOG("onRewardAdLoaded");
};
void ClassName::onRewardAdFailedToLoad(){
    CCLOG("onRewardAdFailedToLoad");
};
void ClassName::onUserEarnedReward(){
    CCLOG("onUserEarnedReward");
};

To Show Overlay Ad

GameAdzone::ShowOverlayAD();

To Show Icon Ad

GameAdzone::showIconAd(X,Y,Height,Width);

To Show App Open Ad

To show app open ads just activate from gameadzone portal. No code is needed Just activate/deactivate from gameadzone portal.

To Activate/Deactivate Any AdFormat