VMAX
 
 
 
 
Show Sidebar

Cocos2d-x SDK for Android

ขออภัยรายการนี้จะใช้ได้เฉพาะในภาษาอังกฤษ English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

For Cocos2d-x version 3 and above.

Overview

VMAX Cocos2d-x Ad SDK is a wrapper around the VMAX Native android Ad SDK. Cocos Studio supports three languages. The current release of SDK only supports integration with C++ version of Cocos2d-x.

Mediation Partners

Interstitial

  • AdColony
  • AdMob
  • Chartboost
  • Facebook Audience Network
  • Flurry
  • Millennial Media
  • Vungle

Interstitial Video

  • Adcolony
  • Chartboost
  • Vungle

Rewarded Video

  • AdColony
  • Chartboost
  • Pokkt
  • UnityAds
  • Vungle

Native Icon

  • Facebook Audience Network (Native)
  • InMobi (Native)

Integrating the VMAX SDK

Prerequisites for Integration

  1. Cocos2d-x 3.x
  2. Android Studio
  3. Android NDK
  4. Apache Ant

Basic Setup

  1. Copy VMAXCocos2dHelper.cpp & VMAXCocos2dHelper.h and paste it to your Classes folder.
  2. In the Cocos2d-x Scene you wish to integrate the VMAX SDK, import the VMAX Cosos2d-x header as:
  3. Add VMAXCocos2dHelper.cpp class path inside jni/Android.mk file.
    For Example – LOCAL_SRC_FILES := ../../Classes/VMAXCocos2dHelper.cpp \
  4. Compile your application to generate the .so file.
  5. Import the project.android-studio generated by Cocos2d-x in Android Studio.
  6. Add module vmax.aar from Plugin/AndroidVMAXSDKAar directory
  7. Add necessary mediation partners to your com.vmax.android.ads.mediation.partners package.
    Mediation Files/ directory contains libraries (jar/aar/library projects) and adapters(java files with package) of the supported mediation partners.
  8. Alternatively, if you’re using Eclipse, follow the steps mentioned here.
  9. Create a package com.vmax.ads in your src directory of project and copy Cocos2dVMAXAdSDK.java file into that.
  10. Must call
    in your Activity onCreate() method.
  11. Maintain Activity specific lifecycle in your activity class using Cocos2dVMAXAdSDK mVMAXAdSDK object

Integration

Instantiating Interstitial Ads

Use the following snippet to create the Interstitial ad and add listener to it:

Instantiating Rewarded Video Ads

Use the following snippet to create the Rewarded video ad and add listener to it.

Wallet APIs

To Get the virtual currency amount

To Award virtual Currency amount

To Spend Virtual currency amount

Instantiating Native Icon Ads

Instantiation of Native Ad icon

Note: Kindly note that loadAd() cannot be used for Native Icon Ads.

Read more on testing the integration here.