PremiumAds AppLovin MAX Adapter — Cocos2d-x
Integrate PremiumAds as a mediation ad source in your Cocos2d-x C++ game through AppLovin MAX.
Supported formats: Banner, MREC, Interstitial, Rewarded, Native
App Open is not supported.
Reference repo: premium-ads/max-adapter-cocos2dx
What this is
AppLovin MAX loads the PremiumAds adapter natively when the MAX dashboard maps a placement to it. You integrate the AppLovin MAX SDK natively in your Cocos2d-x project (Gradle on Android, CocoaPods on iOS) exactly as you normally would — this integration does not replace or wrap the MAX SDK. It only adds:
- The PremiumAds adapter dependency to your native project (Gradle/Podfile snippets below).
- A tiny C++ bridge so you can optionally toggle verbose adapter logging from game code.
This is a copy-in integration, not a sample app: copy the files below into your existing Cocos2d-x project.
Prerequisites
- Cocos2d-x with the AppLovin MAX SDK already integrated natively (Android + iOS)
1. Copy the Bridge
Copy Classes/PremiumAdsMaxBridge/ from the reference repo into your project's Classes/ folder as-is:
YourGame/
├── Classes/
│ └── PremiumAdsMaxBridge/
│ ├── PremiumAdsMaxAdapter.h # namespace premiumads::MaxAdapter
│ ├── PremiumAdsMaxAdapter.cpp # Android impl (JniHelper)
│ └── PremiumAdsMaxAdapter.mm # iOS impl (Objective-C++)
Add both PremiumAdsMaxAdapter.cpp and PremiumAdsMaxAdapter.mm to your build:
- Android (
proj.android-studio/app/CMakeLists.txtorjni/Android.mk): addPremiumAdsMaxAdapter.cppto your sources (the.mmfile is Objective-C++ and is not compiled on Android — leave it out of the Android build if your source list is explicit rather than globbed). - iOS/macOS (Xcode,
proj.ios_mac/*.xcodeproj): add bothPremiumAdsMaxAdapter.cppandPremiumAdsMaxAdapter.mmto the target's "Compile Sources" build phase.
Each file compiles to a no-op translation unit on platforms other than the one it targets, so it's safe to add both files everywhere and let the CC_TARGET_PLATFORM guards do the rest.
2. Android Dependency
Add the adapter AAR to your app module's build.gradle — see proj-snippets/build.gradle.snippet:
repositories {
maven { url 'https://repo.premiumads.net/artifactory/mobile-ads-sdk/' }
}
dependencies {
implementation 'net.premiumads.sdk:max-adapter:1.0.0'
}
3. iOS Dependency
Add the adapter pod to your Podfile — see proj-snippets/Podfile.snippet:
pod 'PremiumAdsMaxAdapter', '~> 1.0.1'
Then pod install and rebuild.
4. Configure the MAX Custom Network
In the AppLovin MAX dashboard, add PremiumAds as a Custom Network:
| Field | Value |
|---|---|
| Network name | PremiumAds Custom Adapter |
| iOS class | PremiumAdsAdapter |
| Android class | net.premiumads.sdk.adapter.max.PremiumAdsAdapter |
| Placement | Your PremiumAds ad unit ID |
5. Use the C++ API
Optional — call once at startup to turn on verbose adapter logging:
#include "PremiumAdsMaxBridge/PremiumAdsMaxAdapter.h"
premiumads::MaxAdapter::setDebug(true);
Logs are tagged [PremiumAdsAdapter]:
- Android Logcat: filter
tag:PremiumAdsAdapter - iOS Xcode console: prefix
[PremiumAdsAdapter]
setDebug is a no-op on desktop/other Cocos2d-x target platforms.
For ad loading, use your existing AppLovin MAX C++ integration — the PremiumAds adapter is invoked by MAX's waterfall, not by application code.
Troubleshooting
Adapter never appears in MAX's initialization log: confirm the AAR/Pod is actually linked (./gradlew :app:dependencies | grep premium, pod list | grep PremiumAds).
New ad units / waterfall changes don't take effect immediately: Changes to ad units or waterfall configuration in the MAX dashboard take 30–60 minutes to propagate.
Ads never load / NO FILL (HTTP 204):
A NO FILL response means the waterfall has no eligible line item for the requesting app/device — check that your ad unit has active demand and that the app's bundle/package ID matches the app configured in the MAX dashboard.
What gets shipped
PremiumAds Cocos2d-x integration is mediation custom-event only — your game continues to use the AppLovin MAX SDK directly. The adapter activates only when MAX's waterfall picks it for a given ad unit. No code changes to your existing ad loading logic are required beyond installing the plugin.
Source Code
Documentation
Support
Contact your PremiumAds account manager or email [email protected]