SDK Integration
One tenant ID, one init call. Ad credentials, placement IDs, and frequency caps are pulled at runtime — rotate them without shipping a new build. Pick your platform below.
Before integrating, register your app in the console and wait for approval. Once approved, the platform generates a tenant_id and provisions ad credentials — that single ID is all the SDK needs.
Requirements: Android API 21+, Java 11+, AGP 8.5.2+. Add the SDK repo and the ad mediation repositories to settings.gradle:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
// AdsPlus SDK (local Maven or your hosted repo)
maven { url = uri("https://your-maven-repo/adsplus") }
// Ad mediation networks
maven { url = uri("https://jfrog.anythinktech.com/artifactory/overseas_sdk") }
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
maven { url = uri("https://artifactory.bidmachine.io/bidmachine") }
maven { url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/") }
}
}Then add the dependency in your app module:
dependencies {
implementation("com.gameadsdk:ads-sdk-android:1.0.0")
}Initialize once on app launch. Ad objects can only be created after the SDK reports success, because placement IDs arrive from the server during init.
Call from Application.onCreate():
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
GADConfig config = new GADConfig.Builder("tp_abc1234567") // from dashboard
.userId("") // empty until the user logs in
.packageId(getPackageName())
.build();
GameAdSDK.getInstance().initialize(this, config, new GADSDKCallback() {
@Override
public void onSDKInitialized() {
// Safe to create ads and call load() from here
}
@Override
public void onSDKInitializeFailed(String error) {
Log.e("AdsPlus", "Init failed: " + error);
}
});
}
}Register your Application class in the manifest:
<application
android:name=".MyApplication"
... >
</application>You can initialize with an empty user ID and set it after the user authenticates. The ID is used for revenue attribution and is forwarded to the mediation layer as custom data.
// After the user authenticates
GameAdSDK.getInstance().updateUserId("authenticated_user_123");Load ahead of time, check isReady before showing, and reload on close to keep one in the chamber. Grant the reward in the reward callback.
String placementId = GameAdSDK.getInstance().getRewardedPlacementId();
RewardedAd rewardedAd = new RewardedAd(placementId);
rewardedAd.setCallback(new RewardedAdCallback() {
@Override
public void onAdLoaded(RewardedAd ad) { /* enable "Watch Ad" button */ }
@Override
public void onAdLoadFailed(RewardedAd ad, String error) { }
@Override
public void onUserRewarded(RewardedAd ad, String rewardType, int rewardAmount) {
// Grant the reward to the user
}
@Override
public void onAdClosed(RewardedAd ad) { ad.load(); } // preload next
});
rewardedAd.load();
// Show when ready
if (rewardedAd.isReady()) {
rewardedAd.show(activity);
}Same load / show lifecycle as rewarded, without a reward callback. Reload after close.
String placementId = GameAdSDK.getInstance().getInterstitialPlacementId();
InterstitialAd interstitialAd = new InterstitialAd(placementId);
interstitialAd.setCallback(new InterstitialAdCallback() {
@Override
public void onAdClosed(InterstitialAd ad) { ad.load(); }
});
interstitialAd.load();
if (interstitialAd.isReady()) {
interstitialAd.show(activity);
}A 300×250 banner. Show it once loaded; toggle visibility with hide() / show().
String placementId = GameAdSDK.getInstance().getMrecPlacementId();
MRECAd mrecAd = new MRECAd(placementId);
mrecAd.setCallback(new MRECAdCallback() {
@Override
public void onAdLoaded(MRECAd ad) {
ad.show(activity); // auto-positioned bottom-center
}
});
mrecAd.load();
// Toggle visibility
mrecAd.hide();
mrecAd.show();Always release ad objects when the hosting screen is torn down to avoid leaks.
@Override
protected void onDestroy() {
super.onDestroy();
rewardedAd.destroy();
interstitialAd.destroy();
mrecAd.destroy();
}Caps are driven by the server and checked automatically before every show(): a global disable flag, a daily limit (capped at 200), and a minimum gap between ads (default 130s ±20s). The SDK falls back to safe local defaults if the backend is unreachable.
You can query the current state manually:
GADLimitChecker.CheckResult result = GADLimitManager.getInstance().canShow();
if (!result.canShow) {
Log.d("AdsPlus", "Blocked: " + result.reason);
}Let web pages hosted in a WebView (wallet pages, task systems) trigger native ads. Attach GADWebViewBridge to your WebView on the native side:
WebView webView = findViewById(R.id.webview);
GADWebViewBridge bridge = new GADWebViewBridge(webView, this);
webView.loadUrl("https://your-server.com/wallet");
// In onDestroy()
bridge.destroy();Load adsplus-bridge.js on your H5 page (host it alongside the page), then call the bridge:
<!-- Host adsplus-bridge.js alongside your H5 page -->
<script src="/adsplus-bridge.js"></script>// Show a rewarded ad from the web page
if (AdsPlusBridge.isAdReady('rewarded')) {
AdsPlusBridge.showRewardedAd({ taskId: 'daily_bonus', rewardAmount: 100 });
}
// React to reward completion (dispatched by the bridge)
window.addEventListener('adsplus:userRewarded', function (e) {
var rewardType = e.detail.rewardType;
var amount = e.detail.amount;
// credit the user
});