Android SDK Integration
Before you begin:
- Have you signed up for a GameADzone account?
- Did you add an app to your dashboard?
- Did you download the latest SDK?
- To download test project Click here.
Requirements and Optional Permissions
- The GameADzone SDK requires API level 17 (Android OS 4.1) or higher.
- Required permission: android.permission.INTERNET
- Required permission: android.permission.WAKE_LOCK
Add GameADzone .aar and dependencies to your Gradle file.
dependencies {
implementation 'com.google.android.gms:play-services-ads:19.8.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 19.8.0 .Do not use Version Higher than 19.8.0.
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) {
}
});
To show a static or video Banner Ad
//Add banner view into your current Layout if(GameADzoneBanner.isLoaded()) { GameADzoneBanner.showView() } Implement Listener that can notify about ad-related events GameADzoneBannerAdListener.setBannerListener(new GameADzoneBannerAdListener.BannerListener() { @Override public void onBannerAdLoaded() { } @Override public void onBannerFailedToLoad() { } });
To use Native Ad
//Currrently Gameadzone is not supporting Native ads,Using Following Method You can Get admob and ad exchange(adx) id which can be used to customise ad in your app.. (link) if(GameADzoneNativeAd.isAvailable()) { String adunit = GameADzoneNativeAd.getAdUnitId(); }
To show interstitial ad:
if(GameADzoneInterstitialAd.isLoaded())
{
GameADzoneInterstitialAd.Show();
}
Implement Listener that can notify about ad-related events.
GameADzoneInterstitialAdListener.setInterstitialListener(new GameADzoneInterstitialAdListener.InterstitialListener() {
@Override
public void onInterstitialAdLoaded() {
Log.v("GameAdzoneInterstitial","onInterstitialAdLoaded");
}
@Override
public void onInterstitialFailedToLoad(int i) {
Log.v("GameAdzoneInterstitial","onInterstitialFailedToLoad");
}
@Override
public void onInterstitialAdOpened() {
Log.v("GameAdzoneInterstitial","onInterstitialAdOpened");
}
@Override
public void onInterstitialAdClosed() {
Log.v("GameAdzoneInterstitial","onInterstitialAdClosed");
}
});
To show MoreApp
GameADzoneMoreApp.Show();
To Show Medium Rectangle Banner Ad(300*250 Fix size)
//Add rectangle banner view into your current Layout if(GameADzoneRectangle.isLoaded()) { GameADzoneRectangle.showView() }
To Show Reward Video
if(GameAdzoneRewardedAd.isLoaded())
{
GameAdzoneRewardedAd.Show();
}
Implement Listener that can notify about ad-related events.
GameAdzoneRewardAdListener.setRewardVideoListener(new GameAdzoneRewardAdListener.RewardVideoListener() {
@Override
public void onRewardAdLoaded() {
Log.v("GameAdzoneReward","onRewardAdLoaded");
}
@Override
public void onRewardAdFailedToLoad(int i) {
Log.v("GameAdzoneReward","onRewardAdFailedToLoad");
}
@Override
public void onUserEarnedReward(RewardItem rewardItem) {
Log.v("GameAdzoneReward","onUserEarnedReward");
}
To Show Overlay Ad
if(GameADzoneOverlayAd.isLoaded()) { GameADzoneOverlayAd.Show(); }
To Show Icon Ad
//Add icon view into your current Layout if(GameADzoneIconAd.isLoaded()) { GameADzoneIconAd.loadView() }
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. App open ad is automatically handled by sdk when application enters from background to foreground. //To show app open ad on Application Launch if(GameADzoneAppOpenAd.isLoaded()) { GameADzoneAppOpenAd.show(); }
To Activate/Deactivate Any AdFormat
