HOW TO IMPLEMENT ADCOLONY AD (BANNER/INTERSTITIAL/REWARDED) SDK IN ANDROID/Kotlin (EXAMPLE CODE)

Share Post
  •  
  •  
  •  
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

Please Subscribe Youtube| Like Facebook | Follow Twitter

For Java follow this article

Introduction

In this article we will learn how to implement AdColony Banner/Interstitial/Rewarded Ads in android application. AdColony allows you to monetize your app by displaying ads.

Our Example

In our example we have two button which will display Interstitial and Reward video Ads respectively on button click. At the bottom of app screen we will display banner ad.

Requirements:

  1. Android Project/App in which AdColony ads to be implemented
  2. AdColony Account

Steps

Follow below steps

1) Create or Sign-in AdColony Account and add application

2) Create Ad units zone id in AdColony account

3) Integrate and code AdColony ads in your app

4) Run and test your application

1) Create or Sign-in AdColony Account and add application

Sign-in to or sign-up for an AdColony account.

After creating account select MONETIZATION -> Setup New App

Fill details according to your requirements

After filling details click on create.

Now after adding app next step is to create ad unit zone id.

2) Create Ad units zone id in AdColony account

Click on created app and copy AdColony App ID and paste it in a text file (we will need this later).

Then click on Setup New Ad Zone to create ad units (Banner/Interstitial/Rewarded)

Set Setting for Banner Ad according to your requirements.

Show test ads only (for dev or debug)? Is set to yes during development, change it to no during production.

After creating banner ad, open it and copy zone id in text file (we will need this later).

Now set Setting for Interstitial Ad according to your requirements and copy its zone id in text file.

Similarly set Setting for Reward Ad (virtual currency, reward amount) according to your requirements and copy its zone id in text file.

After creating (Banner/Interstitial/Rewarded) ad unit, next step is to integrate adcolony in your app.

3) Integrate and code AdColony ads in your app

At project level build.gradle file add maven { url  “https://adcolony.bintray.com/AdColony”}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url  "https://adcolony.bintray.com/AdColony"
        }
    }
}

At app level build.gradle file add adcolony sdk dependency and sync project

implementation 'com.adcolony:sdk:4.1.4'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'

In manifest file add internet and vibrate permission and inside application tag add attribute android:usesCleartextTraffic=”true”. Also add two Adcolony activities inside application tag, it is requirement for ads.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.programtown.example">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        >
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"/>
        <activity android:name="com.adcolony.sdk.AdColonyAdViewActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"/>
    </application>

</manifest>

In proguard-rules.pro file add below ProGuard Configuration

# For communication with AdColony's WebView
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

Below is code for layout file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical"
    >

    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="Display InterstitialAd"
        android:onClick="displayInterstitialAd"
        ></Button>
    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="Display Reward Video Ad"
        android:onClick="displayRewardVideoAd"
        ></Button>
    <View
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        ></View>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:gravity="center"
        android:id="@+id/bannerConatiner"
        >

    </LinearLayout>

</LinearLayout>

Now Inside MainActivity’s companion object add app id and (Banner/Interstitial/Rewarded) zone id which was copied during step 2 in a text file. Here we have used our own sample ids replace it with your own ids.

companion object {
	private const val APP_ID = "app7dd43d11ae344f74af"
	private const val BANNER_ZONE_ID = "vz5ccc44c8de0c43f7a8"
	private const val INTERSTITIAL_ZONE_ID = "vz614303d8339f4b95b4"
	private const val REWARD_ZONE_ID = "vze9db182f005c424597"
	val AD_UNIT_Zone_Ids = arrayOf(BANNER_ZONE_ID, INTERSTITIAL_ZONE_ID, REWARD_ZONE_ID)
	private var isInterstitialLoaded = false
	private var isRewardLoaded = false
}

On app start we have called initColonySdk() method which will initialize AdColony SDK.

private fun initColonySdk() {
	// Construct optional app options object to be sent with configure
	val appOptions = AdColonyAppOptions().setKeepScreenOn(true)
	// Configure AdColony in your launching Activity's onCreate() method so that cached ads can
	// be available as soon as possible.
	AdColony.configure(application, appOptions, APP_ID, *AD_UNIT_Zone_Ids)
}

initBannerAd() method will request and load banner ad at the bottom of screen. bannerListener is defined to write your custom action on particular ad event. On onRequestFilled() method we will get adColonyAdView object from adcolony Ad Server.

private fun initBannerAd() {

	//Remove previous ad view if present.
	val bannerListener: AdColonyAdViewListener = object : AdColonyAdViewListener() {
		override fun onRequestFilled(adColonyAdView: AdColonyAdView) {
			//Remove previous ad view if present.
			if (bannerConatiner.childCount > 0) {
				bannerConatiner.removeView(bannerAdColony)
			}
			bannerConatiner.addView(adColonyAdView)
			bannerAdColony = adColonyAdView
		}

		override fun onRequestNotFilled(zone: AdColonyZone) {
			super.onRequestNotFilled(zone)
		}

		override fun onOpened(ad: AdColonyAdView) {
			super.onOpened(ad)
		}

		override fun onClosed(ad: AdColonyAdView) {
			super.onClosed(ad)
		}

		override fun onClicked(ad: AdColonyAdView) {
			super.onClicked(ad)
		}

		override fun onLeftApplication(ad: AdColonyAdView) {
			super.onLeftApplication(ad)
		}
	}
	// Optional Ad specific options to be sent with request
	val adOptions = AdColonyAdOptions()
	//Request Ad
	AdColony.requestAdView(BANNER_ZONE_ID, bannerListener, AdColonyAdSize.BANNER, adOptions)
}

In initInterstitialAd() method will request and load Interstitial Ad. interstitialListener is defined to write your custom action on particular ad event. On onRequestFilled() method we will get AdColonyInterstitial object from adcolony Ad Server. On onClosed() method we have again requested next Interstitial ad.

private fun initInterstitialAd() {
	// Set up listener for interstitial ad callbacks. You only need to implement the callbacks
	// that you care about. The only required callback is onRequestFilled, as this is the only
	// way to get an ad object.
	interstitialListener = object : AdColonyInterstitialListener() {
		override fun onRequestFilled(adIn: AdColonyInterstitial) {
			// Ad passed back in request filled callback, ad can now be shown
			interstitialAdColony = adIn
			isInterstitialLoaded = true
		}

		override fun onRequestNotFilled(zone: AdColonyZone) {
			super.onRequestNotFilled(zone)
		}

		override fun onOpened(ad: AdColonyInterstitial) {
			super.onOpened(ad)
		}

		override fun onClosed(ad: AdColonyInterstitial) {
			super.onClosed(ad)
			//request new Interstitial Ad on close
			AdColony.requestInterstitial(INTERSTITIAL_ZONE_ID, interstitialListener!!, interstitialAdOptions)
		}

		override fun onClicked(ad: AdColonyInterstitial) {
			super.onClicked(ad)
		}

		override fun onLeftApplication(ad: AdColonyInterstitial) {
			super.onLeftApplication(ad)
		}

		override fun onExpiring(ad: AdColonyInterstitial) {
			super.onExpiring(ad)
		}
	}
	// Optional Ad specific options to be sent with request
	interstitialAdOptions = AdColonyAdOptions()
	AdColony.requestInterstitial(INTERSTITIAL_ZONE_ID, interstitialListener!!, interstitialAdOptions)
}

displayInterstitialAd() method will display Interstitial ad on button click. If ad is not loaded or ad request not filled from server then it will display toast message.

fun displayInterstitialAd(view: View?) {
	if (interstitialAdColony != null && isInterstitialLoaded) {
		interstitialAdColony!!.show()
		isInterstitialLoaded = false
	} else {
		Toast.makeText(applicationContext, "Interstitial Ad Is Not Loaded Yet or Request Not Filled", Toast.LENGTH_SHORT).show()
	}
}

In initRewardedAd () method will request and load Reward Ad. rewardListener is defined to write your custom action on particular ad event. On onRequestFilled() method we will get AdColonyInterstitial Reward object from adcolony Ad Server. On onClosed() method we have again requested next Reward  ad. AdColony.setRewardListener() is defined to check result of reward video if reward is watched successfully then we will toast Reward Earned else Toast Reward Cancelled

private fun initRewardedAd() {
	// Create and set a reward listener
	AdColony.setRewardListener { reward -> // Query reward object for info here
		//here reward vid is seen by user
		//you can use this listener inside activity also
		if (reward.success()) {
			Toast.makeText(applicationContext, "Reward Earned", Toast.LENGTH_SHORT).show()
		} else {
			Toast.makeText(applicationContext, "Reward Cancelled", Toast.LENGTH_SHORT).show()
		}
	}
	// Set up listener for interstitial ad callbacks. You only need to implement the callbacks
	// that you care about. The only required callback is onRequestFilled, as this is the only
	// way to get an ad object.
	rewardListener = object : AdColonyInterstitialListener() {
		override fun onRequestFilled(adReward: AdColonyInterstitial) {
			// Ad passed back in request filled callback, ad can now be shown
			rewardAdColony = adReward
			isRewardLoaded = true
		}

		override fun onRequestNotFilled(zone: AdColonyZone) {

		}
		override fun onOpened(ad: AdColonyInterstitial) {
			super.onOpened(ad)
		}

		override fun onClosed(ad: AdColonyInterstitial) {
			super.onClosed(ad)
			//request new reward on close
			AdColony.requestInterstitial(REWARD_ZONE_ID, rewardListener!!, rewardAdOptions)
		}

		override fun onClicked(ad: AdColonyInterstitial) {
			super.onClicked(ad)
		}

		override fun onLeftApplication(ad: AdColonyInterstitial) {
			super.onLeftApplication(ad)
		}

		override fun onExpiring(ad: AdColonyInterstitial) {
			super.onExpiring(ad)
		}
	}
	// Ad specific options to be sent with request
	rewardAdOptions = AdColonyAdOptions()
			.enableConfirmationDialog(false)
			.enableResultsDialog(false)
	AdColony.requestInterstitial(REWARD_ZONE_ID, rewardListener!!, rewardAdOptions)
}

displayRewardVideoAd() method will show reward ad on button click. If ad is not loaded or ad request not filled from server then it will display toast message.

fun displayRewardVideoAd(view: View?) {
	if (rewardAdColony != null && isRewardLoaded) {
		rewardAdColony!!.show()
		isRewardLoaded = false
	} else {
		Toast.makeText(applicationContext, "Reward Ad Is Not Loaded Yet or Request Not Filled", Toast.LENGTH_SHORT).show()
	}
}

Whole Code

project level build.gradle

buildscript {
    ext.kotlin_version = '1.4.0-rc'
    repositories {
        jcenter()
        google()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url  "https://adcolony.bintray.com/AdColony"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app level build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.programtown.example"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    implementation 'com.adcolony:sdk:4.1.4'
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation "androidx.core:core-ktx:1.3.1"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

}
repositories {
    maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    mavenCentral()
}

proguard-rules.pro file

# For communication with AdColony's WebView
-keepclassmembers class * {
    @android.webkit.JavascriptInterface <methods>;
}

manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.programtown.example">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        >
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"/>
        <activity android:name="com.adcolony.sdk.AdColonyAdViewActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
            android:hardwareAccelerated="true"/>
    </application>

</manifest>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:orientation="vertical"
    >

    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="Display InterstitialAd"
        android:onClick="displayInterstitialAd"
        ></Button>
    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:text="Display Reward Video Ad"
        android:onClick="displayRewardVideoAd"
        ></Button>
    <View
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="5"
        ></View>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:gravity="center"
        android:id="@+id/bannerConatiner"
        >

    </LinearLayout>

</LinearLayout>

MainActivity.kt

package com.programtown.example

import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.adcolony.sdk.*
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    private var bannerAdColony: AdColonyAdView? = null
    private var interstitialAdColony: AdColonyInterstitial? = null
    private var interstitialListener: AdColonyInterstitialListener? = null
    private var interstitialAdOptions: AdColonyAdOptions? = null
    private var rewardAdColony: AdColonyInterstitial? = null
    private var rewardListener: AdColonyInterstitialListener? = null
    private var rewardAdOptions: AdColonyAdOptions? = null

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        initColonySdk()
        initBannerAd()
        initInterstitialAd()
        initRewardedAd()
    }

    private fun initColonySdk() {
        // Construct optional app options object to be sent with configure
        val appOptions = AdColonyAppOptions().setKeepScreenOn(true)
        // Configure AdColony in your launching Activity's onCreate() method so that cached ads can
        // be available as soon as possible.
        AdColony.configure(application, appOptions, APP_ID, *AD_UNIT_Zone_Ids)
    }

    private fun initBannerAd() {

        //Remove previous ad view if present.
        val bannerListener: AdColonyAdViewListener = object : AdColonyAdViewListener() {
            override fun onRequestFilled(adColonyAdView: AdColonyAdView) {
                //Remove previous ad view if present.
                if (bannerConatiner.childCount > 0) {
                    bannerConatiner.removeView(bannerAdColony)
                }
                bannerConatiner.addView(adColonyAdView)
                bannerAdColony = adColonyAdView
            }

            override fun onRequestNotFilled(zone: AdColonyZone) {
                super.onRequestNotFilled(zone)
            }

            override fun onOpened(ad: AdColonyAdView) {
                super.onOpened(ad)
            }

            override fun onClosed(ad: AdColonyAdView) {
                super.onClosed(ad)
            }

            override fun onClicked(ad: AdColonyAdView) {
                super.onClicked(ad)
            }

            override fun onLeftApplication(ad: AdColonyAdView) {
                super.onLeftApplication(ad)
            }
        }
        // Optional Ad specific options to be sent with request
        val adOptions = AdColonyAdOptions()
        //Request Ad
        AdColony.requestAdView(BANNER_ZONE_ID, bannerListener, AdColonyAdSize.BANNER, adOptions)
    }

    private fun initInterstitialAd() {
        // Set up listener for interstitial ad callbacks. You only need to implement the callbacks
        // that you care about. The only required callback is onRequestFilled, as this is the only
        // way to get an ad object.
        interstitialListener = object : AdColonyInterstitialListener() {
            override fun onRequestFilled(adIn: AdColonyInterstitial) {
                // Ad passed back in request filled callback, ad can now be shown
                interstitialAdColony = adIn
                isInterstitialLoaded = true
            }

            override fun onRequestNotFilled(zone: AdColonyZone) {
                super.onRequestNotFilled(zone)
            }

            override fun onOpened(ad: AdColonyInterstitial) {
                super.onOpened(ad)
            }

            override fun onClosed(ad: AdColonyInterstitial) {
                super.onClosed(ad)
                //request new Interstitial Ad on close
                AdColony.requestInterstitial(INTERSTITIAL_ZONE_ID, interstitialListener!!, interstitialAdOptions)
            }

            override fun onClicked(ad: AdColonyInterstitial) {
                super.onClicked(ad)
            }

            override fun onLeftApplication(ad: AdColonyInterstitial) {
                super.onLeftApplication(ad)
            }

            override fun onExpiring(ad: AdColonyInterstitial) {
                super.onExpiring(ad)
            }
        }
        // Optional Ad specific options to be sent with request
        interstitialAdOptions = AdColonyAdOptions()
        AdColony.requestInterstitial(INTERSTITIAL_ZONE_ID, interstitialListener!!, interstitialAdOptions)
    }

    private fun initRewardedAd() {
        // Create and set a reward listener
        AdColony.setRewardListener { reward -> // Query reward object for info here
            //here reward vid is seen by user
            //you can use this listener inside activity also
            if (reward.success()) {
                Toast.makeText(applicationContext, "Reward Earned", Toast.LENGTH_SHORT).show()
            } else {
                Toast.makeText(applicationContext, "Reward Cancelled", Toast.LENGTH_SHORT).show()
            }
        }
        // Set up listener for interstitial ad callbacks. You only need to implement the callbacks
        // that you care about. The only required callback is onRequestFilled, as this is the only
        // way to get an ad object.
        rewardListener = object : AdColonyInterstitialListener() {
            override fun onRequestFilled(adReward: AdColonyInterstitial) {
                // Ad passed back in request filled callback, ad can now be shown
                rewardAdColony = adReward
                isRewardLoaded = true
            }

            override fun onRequestNotFilled(zone: AdColonyZone) {

            }
            override fun onOpened(ad: AdColonyInterstitial) {
                super.onOpened(ad)
            }

            override fun onClosed(ad: AdColonyInterstitial) {
                super.onClosed(ad)
                //request new reward on close
                AdColony.requestInterstitial(REWARD_ZONE_ID, rewardListener!!, rewardAdOptions)
            }

            override fun onClicked(ad: AdColonyInterstitial) {
                super.onClicked(ad)
            }

            override fun onLeftApplication(ad: AdColonyInterstitial) {
                super.onLeftApplication(ad)
            }

            override fun onExpiring(ad: AdColonyInterstitial) {
                super.onExpiring(ad)
            }
        }
        // Ad specific options to be sent with request
        rewardAdOptions = AdColonyAdOptions()
                .enableConfirmationDialog(false)
                .enableResultsDialog(false)
        AdColony.requestInterstitial(REWARD_ZONE_ID, rewardListener!!, rewardAdOptions)
    }

    fun displayInterstitialAd(view: View?) {
        if (interstitialAdColony != null && isInterstitialLoaded) {
            interstitialAdColony!!.show()
            isInterstitialLoaded = false
        } else {
            Toast.makeText(applicationContext, "Interstitial Ad Is Not Loaded Yet or Request Not Filled", Toast.LENGTH_SHORT).show()
        }
    }

    fun displayRewardVideoAd(view: View?) {
        if (rewardAdColony != null && isRewardLoaded) {
            rewardAdColony!!.show()
            isRewardLoaded = false
        } else {
            Toast.makeText(applicationContext, "Reward Ad Is Not Loaded Yet or Request Not Filled", Toast.LENGTH_SHORT).show()
        }
    }

    companion object {
        private const val APP_ID = "app7dd43d11ae344f74af"
        private const val BANNER_ZONE_ID = "vz5ccc44c8de0c43f7a8"
        private const val INTERSTITIAL_ZONE_ID = "vz614303d8339f4b95b4"
        private const val REWARD_ZONE_ID = "vze9db182f005c424597"
        val AD_UNIT_Zone_Ids = arrayOf(BANNER_ZONE_ID, INTERSTITIAL_ZONE_ID, REWARD_ZONE_ID)
        private var isInterstitialLoaded = false
        private var isRewardLoaded = false
    }
}

4) Run and test your application

Make sure you are connected to internet and then run app. After Running app at the bottom banner ad will be shown.

On Display InterstitialAd button click will show Interstitial Ad

On Display Reward Video Ad button click will show Reward Ad

Conclusion

In this post we have learned how to add AdColony Ads SDK in android application.

Please Subscribe Youtube| Like Facebook | Follow Twitter


Share Post
  •  
  •  
  •  
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

2 Replies to “HOW TO IMPLEMENT ADCOLONY AD (BANNER/INTERSTITIAL/REWARDED) SDK IN ANDROID/Kotlin (EXAMPLE CODE)”

  1. Wow that was odd. I just wrote an extremely long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say fantastic blog!

Leave a Reply

Your email address will not be published. Required fields are marked *