facebook

Android Mediation Integration (for v.12.x.x & above)

Getting Started

This documentation will help you integrate ConsoliAds Android SDK to get instant access to the best ad networks around the globe for optimized mobile ad analytics and earnings. 

In case you are updating to v11.x.x from older versions of ConsoliAds, please see section ‘Updating from Older Versions’ and proceed to ‘Ready to Code’

Before you proceed to integrate, make sure you have:

Updating from Older Versions

NOTE: You can skip this step if you are integrating ConsoliAds plugin for the first time

The apps details of the versions older than 11.x.x appear on the ConsoliAds dashboard as follows:

Once you develop on the latest version and run your build on the DEV mode, your ConsoliAds dashboard will be updated to the latest mediation features as follows:

Mandatory steps to follow

Before starting to develop on ConsoliAds Android SDK 11.x.x, please make sure to:

  1. Completely clean already integrated ConsoliAds: completely remove Consoliads SDK relevant files in the libs folder.
  2. Go through the 11.x.x complete documentation: thoroughly read the new documentation as a lot has been changed to faster implement the new level of ease

Please note that you will be able to add placeholders as per the SDK ENUMs once the dashboard is updated.

Create an App

NOTE: You can skip this step if you’ve already created your app on ConsoliAds dashboard

    1. From the left sidebar, navigate to Apps → New App

      2. Simply import your Live app or manually enter the required information and proceed to ‘Finish’ to instantly create your app

Download Android SDK

  1. Download the latest ConsoliAds Android SDK from https://portal.consoliads.com/download/Android
  2. Download the desired Ad Networks SDKs from https://portal.consoliads.com/download/adnetworksdk/Android

Setting Up Project Dependencies

Integrating SDK

Once the ConsoliAds mediation SDK is downloaded: 

    • copy all ‘.aar’ files to your android project inside the “libs” folder. Please create a “libs” folder inside your Android Studio app if it does not exist.
    • Open your project level “build.gradle” and write the following under allprojects → repositories section:
flatDir { dirs 'libs' }
  • Open your app level “build.gradle” and write the following lines in the dependencies section to import ConsoliAds SDK:
implementation(name: 'consoliadsmediation', ext: 'aar')
implementation(name: 'consoliads-mediation', ext: 'aar')
implementation(name: 'consoliadsplugin', ext: 'aar')
implementation(name: 'loaderlibrary', ext: 'aar')
implementation(name: 'ca-nativeads', ext: 'aar')

Adding Dependencies

ConsoliAds SDK requires the following libraries as dependencies. Open your app level “build.gradle” and add following dependencies:

implementation 'com.google.android.gms:play-services-basement:17.6.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' 
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.code.gson:gson:2.8.5'

** Your project settings should be ready to support ConsoliAds in your android code to add all the ad placements for all supported ad formats **

Ready to Code

SDK Initialization

ConsoliAds SDK needs to be explicitly initialized, using the following code.

ConsoliAds.Instance().initialize(boolean isDevMode, final boolean userConsent, Activity aRef ,String userSignature);

devMode: when true, it simulates the development environment and prevents developers from changing Live app settings. Complete app development should be done with ‘Dev Mode’ ON. When an app is ready to be published, ‘Dev Mode’ MUST BE turned OFF. (NOTE: Don’t forget to see ‘More About Dev Mode’ section before making the final build)

userConsent: TRUE if user agrees to share his data and opts for personalized ads, FALSE otherwise. This flag is used for GDPR and CCPA compliance both. 

aRef: reference of the current Activity

userSignature: string to identify the user according to his role and rights provided on the ConsoliAds dashboard

    1. The user signature can be obtained by going to your Personal Info by clicking on your name in the right corner of the top bar on your dashboard
    2. Copy the required user signature for the above initialize argument

NOTE: all initialize params cannot be modified once ConsoliAds is initialized

Show Interstitial/Video Ad

Load Interstitial Ad

Showing interstitial ad requires loading it beforehand. Use the following method to load a interstitial ad:

ConsoliAds.Instance().LoadInterstitial();

OR

ConsoliAds.Instance().LoadInterstitial(PlaceholderName placeholderName);

It is highly recommended to call LoadInterstitial() as early as possible to allow ads to be pre-loaded.

NOTE: calling LoadInterstitial multiple times does not results in multiple ad network requests

Check Interstitial/Video Ad Availability

Despite having the ad load called, interstitial ad availability should be explicitly checked. Check interstitial ad availability by using following method:

ConsoliAds.Instance().IsInterstitialAvailable();

OR

 ConsoliAds.Instance().IsInterstitialAvailable(PlaceholderName placeholderNam);

PlaceholderName: enum of the placeholder (such as PlaceholderName.Default, PlaceholderName.Activity1) from the ‘Placeholders’ tab in your app details of the ConsoliAds dashboard. No placeholder value is required if you do not have your own placeholders added.

Return value (boolean):

  • True if the ad is available
  • False if the ad is not available

Show Interstitial Video

Now add the following lines of code to show an interstitial ad in your app:

ConsoliAds.Instance().ShowInterstitial(Activity aRef)

OR

ConsoliAds.Instance().ShowInterstitial(PlaceholderName placeholderName , Activity aRef)

Parameter details:

  • PlaceholderName:  enum of the placeholder (such as PlaceholderName.Default, PlaceholderName.Activity1) from the ‘Placeholders’ tab in your app details of the ConsoliAds dashboard. No placeholder value is required if you do not have your own placeholders added.
  • aRef: Reference of the Activity

NOTE: the respective placeholder must have an ad network added from the ConsoliAds dashboard, else no ad will be displayed

Static Interstitial Ad

To show an Image Only interstitial ad, enable Static Interstitial option on your desired placeholder from the App Details->Placeholders & Ads section as shown below:

Note: Ad networks that support Static Interstitials will be tagged on the waterfall and will be used for ad serving accordingly.

Show Rewarded Video Ad

Load Rewarded Ad

Showing rewarded video requires loading it beforehand. Use the following method to load a rewarded ad:

ConsoliAds.Instance().LoadRewarded();

OR

ConsoliAds.Instance().LoadRewarded(PlaceholderName placeholderName);

It is highly recommended to call LoadRewarded() as early as possible to allow videos to be pre-loaded.

Availability of Rewarded Ad

Despite having the ad load called, rewarded video availability should be explicitly checked. Check rewarded video ad availability by using following method:

ConsoliAds.Instance().IsRewardedVideoAvailable();

OR

ConsoliAds.Instance().IsRewardedVideoAvailable(PlaceholderName);

PlaceholderName: enum of the placeholder (such as PlaceholderName.Default, PlaceholderName.MainMenu) from the ‘Placeholders’ tab in your app details of the ConsoliAds dashboard. No placeholder value is required if you do not have your own placeholders added.

Return value (boolean):

  • True if the ad is available
  • False if the ad is not available

Show Rewarded Video

ConsoliAds.Instance().ShowRewardedVideo(Activity aRef);

OR

ConsoliAds.Instance().ShowRewardedVideo(PlaceholderName placeholderName, Activity aRef);

Parameter details:

  • PlaceholderName:  enum of the placeholder (such as PlaceholderName.Default, PlaceholderName.Activity1) from the ‘Placeholders’ tab in your app details of the ConsoliAds dashboard. No placeholder value is required if you do not have your own placeholders added.
  • aRef: Reference of the active Activity

NOTE: the respective placeholder must have an ad network added from the ConsoliAds dashboard, else no ad will be displayed

Reward Users

In order to reward your user, a callback needs to be implemented with your lines of code to incentivize the user. ConsoliAds mediation SDK implements a single callback irregardless of any ad network used.

Implement the interface ConsoliAdsRewardedListener to provide the following definition of the method to reward your users: 

public void onRewardedVideoAdCompletedEvent(PlaceholderName placeholderName)
{
	// Write your code to reward your user here
}

Show Banner Ad

To show banner ad you need to first add the following view to your required activity xml:

<com.consoliads.mediation.bannerads.CAMediatedBannerView
    android:id="@+id/consoli_banner_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="8dp" 
/>

Get the banner view as follows:

CAMediatedBannerView mediatedBannerView = findViewById(R.id.consoli_banner_view);

Now use the following code to display the banner:

ConsoliAds.Instance().ShowBanner(Activity aRef, CAMediatedBannerView mediatedBannerView);

OR

ConsoliAds.Instance().ShowBanner(PlaceholderName placeholderName , Activity aRef, CAMediatedBannerView mediatedBannerView);

Parameter details:

  • PlaceholderName:  enum of the placeholder (such as PlaceholderName.Default, PlaceholderName.Activity1) from the ‘Placeholders’ tab in your app details of the ConsoliAds dashboard. No placeholder value is required if you do not have your own placeholders added.
  • aRef: Reference of the active Activity

NOTE: ConsoliAds SDK supports only one banner per activity.

Show Custom Banner

Admob users can show custom banner by setting property of the mediated view before ShowBanner call:

mediatedBannerView.setCustomBanner(int width , int height);

OR

ConsoliAds.Instance().ShowBanner(PlaceholderName placeholderName , Activity aRef, CAMediatedBannerView mediatedBannerView);

Hide Banner Ad

To hide banner, use the following:

if(mediatedBannerView != null) {
    mediatedBannerView.destroyBanner();
}

Add Banner Listener

To receive callbacks for banner ad type, add banner listener on the mediated view as follows:

cAMediatedBannerView.setBannerListener(ConsoliAdsBannerListener consoliAdsBannerListener);

Show Native Ad

Add the following NativeView in your xml where you want to show the native ad:

<?xml version="1.0" encoding="utf-8"?>
<com.consoliads.mediation.nativeads.CANativeAdView xmlns:android="http://schemas.android.com/apk/res/android"
   android:background="#FFF"
   android:id="@+id/native_ad_frame"
   android:layout_width="match_parent"
   android:layout_height="match_parent">

   <com.consoliads.mediation.nativeads.CACustomView
       android:id="@+id/native_custom_view"
       android:layout_width="match_parent"
       android:layout_height="match_parent">

       <RelativeLayout
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           android:padding="4dp">

           <RelativeLayout
               android:id="@+id/ad_top_view"
               android:layout_width="match_parent"
               android:layout_height="wrap_content">

               <com.consoliads.mediation.nativeads.CAAppIconView
                   android:id="@+id/native_ad_icon"
                   android:layout_width="35dp"
                   android:layout_height="35dp" />

               <LinearLayout
                   android:layout_toStartOf="@id/ad_choices_container"
                   android:layout_toLeftOf="@id/ad_choices_container"
                   android:layout_toEndOf="@id/native_ad_icon"
                   android:layout_toRightOf="@id/native_ad_icon"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:orientation="vertical"
                   android:paddingLeft="4dp"
                   android:paddingRight="4dp">

                   <TextView
                       android:id="@+id/native_ad_title"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:ellipsize="end"
                       android:lines="1"
                       android:textColor="@android:color/black"
                       android:textSize="15sp" />

                   <TextView
                       android:id="@+id/native_ad_sub_title"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"
                       android:ellipsize="end"
                       android:lines="1"
                       android:textColor="@android:color/darker_gray"
                       android:textSize="12sp" />

               </LinearLayout>

               <com.consoliads.mediation.nativeads.CAAdChoicesView
                   android:layout_margin="4dp"
                   android:id="@+id/ad_choices_container"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_alignParentEnd="true"
                   android:layout_alignParentRight="true"
                   />

           </RelativeLayout>

           <com.consoliads.mediation.nativeads.CAMediaView
               android:layout_marginTop="2dp"
               android:layout_above="@+id/ad_bottom_view"
               android:layout_below="@+id/ad_top_view"
               android:id="@+id/native_ad_media"
               android:layout_width="match_parent"
               android:layout_height="match_parent"/>

           <RelativeLayout
               android:layout_marginTop="2dp"
               android:id="@+id/ad_bottom_view"
               android:layout_alignParentBottom="true"
               android:layout_width="match_parent"
               android:layout_height="wrap_content">

               <LinearLayout
                   android:gravity="top|start|left"
                   android:layout_toLeftOf="@+id/native_ad_call_to_action"
                   android:layout_toStartOf="@+id/native_ad_call_to_action"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:orientation="vertical">

                   <TextView
                       android:id="@+id/native_ad_body"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:ellipsize="end"
                       android:gravity="center_vertical"
                       android:lines="2"
                       android:textColor="@android:color/black"
                       android:textSize="12sp" />

                   <TextView
                       android:id="@+id/native_ad_sponsored_label"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:ellipsize="end"
                       android:lines="1"
                       android:textColor="@android:color/darker_gray"
                       android:textSize="12sp" />

               </LinearLayout>

               <com.consoliads.mediation.nativeads.CACallToActionView
                   android:layout_alignParentRight="true"
                   android:layout_alignParentEnd="true"
                   android:id="@+id/native_ad_call_to_action"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_gravity="center_vertical"
                   android:background="#4286F4"
                   android:padding="4dp"
                   android:textColor="@android:color/white"
                   android:textSize="12sp" />

           </RelativeLayout>

       </RelativeLayout>

   </com.consoliads.mediation.nativeads.CACustomView>

</com.consoliads.mediation.nativeads.CANativeAdView>

Declare native ad components in your activity:

TextView title , subtitle , body , sponsored;
CANativeAdView adView;
CACustomView customView;
CAAdChoicesView adChoicesView;
CAAppIconView appIconView;
CAMediaView mediaView;
CACallToActionView actionView;
MediatedNativeAd mediatedNativeAd;

Now initialize the declared ad components:

title = findViewById(R.id.native_ad_title);
subtitle = findViewById(R.id.native_ad_sub_title);
body = findViewById(R.id.native_ad_body);
sponsored = findViewById(R.id.native_ad_sponsored_label);
adView = findViewById(R.id.native_ad_frame);
customView = findViewById(R.id.native_custom_view);
adChoicesView = findViewById(R.id.ad_choices_container);
appIconView = findViewById(R.id.native_ad_icon);
mediaView = findViewById(R.id.native_ad_media);
actionView = findViewById(R.id.native_ad_call_to_action);

Show native ad using:

ConsoliAds.Instance().loadNativeAd(PlaceholderName nativePlaceholderName, NativeAdActivity.this, new ConsoliAdsNativeListener() {

   @Override
   public void onNativeAdLoaded(MediatedNativeAd ad) {
   	Log.i("ConsoliAdsListners","onNativeAdLoaded");
   	mediatedNativeAd = ad;
   	adView.setVisibility(View.VISIBLE);
   	actionView.setTextColor("#ffffff");
   	actionView.setTextSize_UNIT_SP(12);
   	mediatedNativeAd.setSponsered(sponsored);
   	mediatedNativeAd.setAdTitle(title);
   	mediatedNativeAd.setAdSubTitle(subtitle);
   	mediatedNativeAd.setAdBody(body);
   	mediatedNativeAd.registerViewForInteraction(NativeAdActivity.this, appIconView , mediaView , actionView ,adView,adChoicesView,customView );
   }

   @Override
   public void onNativeAdLoadFailed() {
   	Log.i("ConsoliAdsListners","onNativeAdLoadFailed");
   }
});

You can destroy native ad using:

if(mediatedNativeAd != null)
{
    mediatedNativeAd.destroy();
}

Show Icon Ad

Add the following xml in your required activity view:

<com.consoliads.sdk.iconads.IconAdView
android:id="@+id/consoli_icon_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.consoliads.sdk.iconads.IconAdView>

Load and show icon ad using:

IconAdView iconAdView = findViewById(R.id.consoli_icon_view);
iconAdView.setAnimationType(IconAnimationConstant.NONE,isAnimationInfinite);
ConsoliAds.Instance().showIconAd(Activity activity, IconAdView iconAdView, IconSize iconSize, ConsoliAdsIconListener consoliAdsIconListener);

OR

ConsoliAds.Instance().showIconAd(PlaceholderName placeholderName, Activity activity, IconAdView iconAdView, IconSize iconSize, ConsoliAdsIconListener consoliAdsIconListener);

isAnimationInfinite is a boolean value which can either be true or false.
IconSize can have the possible enum values:

  1. IconSize.SmallIcon
  2. IconSize.MediumIcon 
  3. IconSize.LargeIcon  

Icon ads can be shown with different types of animations. You can pass following possible enum values to the setIcon function:

  1. NONE
  2. SHAKE
  3. PULSE   

Hide All Ads

You can hide all ads, except Rewarded Ads, from your entire app, by using the following:

ConsoliAds.Instance.hideAllAds();

NOTE: You only need to call this method once in your script to hide all ads from your app

Using More Apps URL and Support Email

  • The more apps URL and support email are added against a particular brand
  • When an app of the respective brand is configured, the more apps URL and support email are available for use
  • To access more apps URL, use: 
ConsoliAds.Instance.MoreFunURL()
  • To access support email, use:
ConsoliAds.Instance.SupportEmail()

More About Dev Mode

  • Please note that the ‘Dev Mode’ has its own following settings to modify your app under development before impacting the LIVE app:
    • Test Mode
    • Hide All Ads
    • Ad Showing Mechanism
  • If you make your build with ‘Dev Mode’ enabled, the ad configurations from ‘Dev. Placeholder and Ads‘ tab on the dashboard would be used.
  • If you make your build with ‘Dev Mode’ disabled, the ad configurations from ‘Live Placeholder and Ads‘ tab on the dashboard would be used.
  • After adding or editing Ad IDs for Admob, Chartboost or Facebook. It is necessary to click the “Apply to Live” button to be applied on Live placeholders and ads

Applying Dev Settings to Live

In order to see the ‘Dev Mode’ settings on ConsoliAds dashboard, open the ‘Placeholder & Ads (DEV)‘ tab in the details of your specific app as shown below:

Click ‘Apply to Live’ to apply these configurations to your live app.

NOTE: if the configurations are mistakenly applied to LIVE, you can undo by modifying the DEV configurations and applying again.

App Settings on ConsoliAds Dashboard

After successfully integrating your app with ConsoliAds SDK, following app settings can be explored on the ConsoliAds dashboard in the App Details section: 

Test Mode

By Default a new application is in Test Mode. In Test Mode only test ads are shown. Test Mode can ONLY be disabled by importing your app’s Live credentials in the Details tab.

Ad Network IDs

If you are using Admob, Facebook Audience Network or Chartboost you need to provide their Ad IDs on the dashboard in your app Ad Networks section. 

All other integrated ad networks will automatically go Live once your app’s Test Mode is disabled. 

Ad Filters

Apply all ad filters, for the integrated ad networks, with complete ease from the ConsoliAds dashboard in the Ad Filters section of the app details.

Debug Logs

If enabled, debug logs will be shown for your app in respective editors for Android and iOS.

Child Directed

Child Directed enables your application with complete COPPA compliance.

Hide Ads

All ads, except Rewarded Videos, can be completely turned OFF using Hide Ads on the dashboard.

Auto Mediation

Auto Mediation automatically optimizes your ad networks for each region and each ad format pertaining to every placeholder in your app such that you get the best eCPMs. 

We highly recommend to use Auto Mediation in order to witness instant revenue increments upto 20%

For Advance Development

More Interface Listeners

ConsoliAds implements a single callback for all Ad Networks to notify when SDK is ready to use. Add the following in onCreate() of your Activity to set ConsoliAds Initialization listener:

ConsoliAds.Instance().setConsoliAdsListener(this);

public interface ConsoliAdsListener {
   void onConsoliAdsInitializationSuccess();
}

Interstitial Listeners

Add the following in onCreate() of your Activity to set interstitial listener:

ConsoliAds.Instance().setConsoliAdsInterstitialListener(this);

public interface ConsoliAdsInterstitialListener {
    void onInterstitialAdLoadedEvent(PlaceholderName placeholderName);
    void onInterstitialAdShownEvent(PlaceholderName placeholderName);
    void onInterstitialAdClickedEvent();
    void onInterstitialAdClosedEvent(PlaceholderName placeholderName);
    void onInterstitialAdFailToLoadEvent(PlaceholderName placeholderName);
    void onInterstitialAdFailedToShowEvent(PlaceholderName placeholderName);
}

Rewarded Video Listeners

Add the following in onCreate() of your Activity to set rewarded video listener:

ConsoliAds.Instance().setConsoliAdsRewardedListener(this);

public interface ConsoliAdsRewardedListener {
    void onRewardedVideoAdLoadedEvent(PlaceholderName placeholderName);
    void onRewardedVideoAdShownEvent(PlaceholderName placeholderName);
    void onRewardedVideoAdCompletedEvent(PlaceholderName placeholderName);
    void onRewardedVideoAdClickEvent();
    void onRewardedVideoAdFailToLoadEvent(PlaceholderName placeholderName);
    void onRewardedVideoAdFailToShowEvent(PlaceholderName placeholderName);
    void onRewardedVideoAdClosedEvent(PlaceholderName placeholderName);
}

Banner Listeners

public interface ConsoliAdsBannerListener {
   void onBannerAdShownEvent();
   void onBannerAdFailToShowEvent();
   void onBannerAdClickEvent();
   void onBannerAdRefreshEvent();
}

Icon Listeners

public interface ConsoliAdsIconListener {
    void onIconAdLoadEvent();
    void onIconAdLoadFailedEvent();
    void onIconAdRefreshEvent();
    void onIconAdShownEvent();
    void onIconAdClosedEvent();
    void onIconAdClickEvent();
}

Native Listeners

public abstract class ConsoliAdsNativeListener {
   public abstract void onNativeAdLoaded(MediatedNativeAd mediatedNativeAd);
   public void onNativeAdLoadFailed();
   public void onNativeAdClicked();
   public void onNativeAdShown();
   public void onNativeAdFailedToShow();
}

Multiple Native Ads in a View

To load native ads in list use:

private void loadNativeAd() {
    ConsoliAds.Instance().loadNativeAd(PlaceholderName placeholderName, , ConsoliAdsListActivity.this, new ConsoliAdsNativeListener() {
       	@Override
       	public void onNativeAdLoaded(MediatedNativeAd mediatedNativeAd) {
  	    dataList.add(listIndex , mediatedNativeAd);
            listViewAdapter.notifyDataSetChanged();
       	}

       	@Override
       	public void onNativeAdLoadFailed() {
            Log.i("ConsoliAdsListners","onNativeAdLoadFailed");
       	}
    });
}

Use this code in RecyclerView Adapter:

private class ConsoliadsNativeAdViewHolder extends RecyclerView.ViewHolder {
   TextView title , subtitle , body ,;
   CANativeAdView adView;
   CACustomView customView;
   CAAdChoicesView adChoicesView;
   CAAppIconView appIconView;
   CAMediaView mediaView;
   CACallToActionView actionView;

   ConsoliadsNativeAdViewHolder(View itemView) {
   	super(itemView);
   	title = itemView.findViewById(R.id.native_ad_title);
   	subtitle = itemView.findViewById(R.id.native_ad_sub_title);
   	body = itemView.findViewById(R.id.native_ad_body);
   	sponsored = itemView.findViewById(R.id.native_ad_sponsored_label);
   	adView = itemView.findViewById(R.id.native_ad_frame);
        customView = view.findViewById(R.id.native_custom_view);
   	adChoicesView = itemView.findViewById(R.id.ad_choices_container);
   	appIconView = itemView.findViewById(R.id.native_ad_icon);
   	mediaView = itemView.findViewById(R.id.native_ad_media);
   	actionView = itemView.findViewById(R.id.native_ad_call_to_action);
    }
}

Bind this view in your Adapter:

ConsoliadsNativeAdViewHolder consoliadsNativeAdViewHolder = (ConsoliadsNativeAdViewHolder) holder;
MediatedNativeAd mediatedNativeAd = (MediatedNativeAd) recipeList.get(position);
consoliadsNativeAdViewHolder.actionView.setTextColor("#ffffff");
consoliadsNativeAdViewHolder.actionView.setTextSize_UNIT_SP(12);
mediatedNativeAd.setSponsered(consoliadsNativeAdViewHolder.sponsered);
mediatedNativeAd.setAdTitle(consoliadsNativeAdViewHolder.title);
mediatedNativeAd.setAdSubTitle(consoliadsNativeAdViewHolder.subtitle);
mediatedNativeAd.setAdBody(consoliadsNativeAdViewHolder.body);
mediatedNativeAd.registerViewForInteraction((Activity) context, 
consoliadsNativeAdViewHolder.appIconView , consoliadsNativeAdViewHolder.mediaView , 
consoliadsNativeAdViewHolder.actionView , 
consoliadsNativeAdViewHolder.adView,consoliadsNativeAdViewHolder.adChoicesView
consoliadsNativeAdViewHolder.customView );

Add/Remove Ad Networks

Admob

Add AdMob

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Admob mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. admob-mediation.aar
  4. In app level “build.gradle”, add ConsoliAds Admob mediation in dependencies.
implementation(name:'admob-mediation', ext: 'aar')
implementation 'com.google.android.gms:play-services-ads:19.7.0'

Note: According to the Admob documentation if you are using play services version greater than 17.x then you have to make sure that you add your Admob appID inside AndroidManifest.xml file. Otherwise, your app will crash.

Remove AdMob Ad Network

Please remove the following files from your project:

  • admob-mediation.aar

In app level “build.gradle”, remove ConsoliAds Admob mediation in dependencies.

implementation(name:'admob-mediation', ext: 'aar')
implementation 'com.google.android.gms:play-services-ads:19.7.0'

Adcolony

Add Adcolony 

Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.

  1. Go to ConsoliAds portal and download ConsoliAds Adcolony mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  2. Copy the following files into libs directory:
    1. adcolony-mediation.aar
  3. Open your app level “build.gradle”, and write the following line to import ConsoliAds Adcolony mediation inside dependencies.
implementation(name:'adcolony-mediation', ext:'aar')

Remove Adcolony 

Please remove the following files from your project:

  • adcolony-mediation.aar

In app level “build.gradle”, remove ConsoliAds Adcolony mediation in dependencies.

implementation(name:'adcolony-mediation', ext:'aar')

Unity Ads

Add Unity Ads 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds UnityAds mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. unityads-mediation.aar
    2. unity-ads_v3.5.1.aar
  4. In app level “build.gradle”, add ConsoliAds UnityAds mediation in dependencies.
implementation(name:'unityads-mediation', ext:'aar')

OR

implementation(name:'unity-ads_v3.6.0', ext:'aar')

Remove Unity Ads 

Please remove the following files from your project:

  • unityads-mediation.aar
  • unity-ads_v3.5.1.aar

In app level “build.gradle”, remove ConsoliAds UnityAds mediation in dependencies.

implementation(name:'unityads-mediation', ext:'aar')
implementation(name:'unity-ads_v3.6.0', ext:'aar')

Facebook Audience Network

 Add Facebook Audience 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Facebook mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. facebook-mediation.aar
    2. AudienceNetwork_v6.2.0.aar
  4. In app level “build.gradle”, add ConsoliAds Facebook mediation in dependencies.
implementation(name:'AudienceNetwork_v6.2.0', ext:'aar')
implementation(name:'facebook-mediation', ext:'aar')

Remove Facebook Audience 

Please remove the following files from your project:

  • facebook-mediation.aar
  • AudienceNetwork_v6.2.0.aar

In app level “build.gradle”, remove ConsoliAds Facebook mediation in dependencies.

implementation(name:'AudienceNetwork_v6.2.0', ext:'aar')
implementation(name:'facebook-mediation', ext:'aar')

Applovin

Add Applovin 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Applovin mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. applovin-mediation.aar
    2. applovin-sdk-9.15.1.aar
  4. In app level “build.gradle”, add ConsoliAds AppLovin mediation in dependencies.
implementation(name:'applovin-mediation', ext:'aar')
implementation(name:'applovin-sdk-9.15.1', ext:'aar')

Remove Applovin 

Please remove the following files from your project:

  • applovin-mediation.aar
  • applovin-sdk-9.15.1.arr

In app level “build.gradle”, remove ConsoliAds AppLovin mediation in dependencies.

implementation(name:'applovin-mediation', ext:'aar')
implementation(name:'applovin-sdk-9.15.1', ext:'aar')

Chartboost

Add Chartboost 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Chartboost mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. Chartboost-mediation.aar
    2. chartboost-sdk-8.2.0.aar
  4. In app level “build.gradle”, add ConsoliAds Chartboost mediation in dependencies.
implementation(name:'chartboost-mediation', ext:'aar')
implementation(name:'chartboost-sdk-8.2.0.aar', ext:'aar')

Remove Chartboost 

Please remove the following files from your project:

  • Chartboost-mediation.aar
  • chartboost-sdk-8.2.0.aar

In app level “build.gradle”, remove ConsoliAds Chartboost mediation in dependencies.

implementation(name:'chartboost-mediation', ext:'aar')
implementation(name:'chartboost-sdk-8.2.0.aar', ext:'aar')

IronSource

Add IronSource 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds IronSource mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. ironsource-mediation.aar
  4. In app level “build.gradle”, add ConsoliAds IronSource mediation in dependencies.
implementation(name:'ironsource-mediation', ext:'aar')

Remove IronSource

Please remove the following files from your project:

  • ironsource-mediation.aar

In app level “build.gradle”, remove ConsoliAds IronSource mediation in dependencies.

implementation(name:'ironsource-mediation', ext:'aar')

Kidoz

Add Kidoz 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Kidoz mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    1. kidoz-mediation.aar
    2. KidozSDK-0.8.9.0.aar
  4. In app level “build.gradle”, add ConsoliAds Kidoz mediation in dependencies.
implementation (name:'kidoz-mediation', ext:'aar')
implementation (name:'KidozSDK-0.8.9.0', ext:'aar')

Remove Kidoz

Please remove the following files from your project:

  • kidoz-mediation.aar
  • KidozSDK-0.8.9.0.aar

In app level “build.gradle”, remove ConsoliAds Kidoz mediation in dependencies.

implementation (name:'kidoz-mediation', ext:'aar')
implementation (name:'KidozSDK-0.8.9.0', ext:'aar')

Mintegral

Add Mintegral 

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Mintegral mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
  • mintegral-mediation.aar
  • mintegral_common.aar
  • mintegral_interactiveads.aar
  • mintegral_interstitial.aar
  • mintegral_interstitialvideo.aar
  • mintegral_mtgbanner.aar
  • mintegral_mtgbid.aar
  • mintegral_mtgjscommon.aar
  • mintegral_mtgnative.aar
  • mintegral_nativeex.aar
  • mintegral_playercommon.aar
  • mintegral_reward.aar
  • mintegral_videocommon.aar
  • Mintegral_videojs.aar

In app level “build.gradle”, add ConsoliAds Mintegral mediation in dependencies.

implementation(name:'mintegral-mediation', ext:'aar')
implementation(name:'mintegral_common', ext: 'aar')
implementation(name:'mintegral_interstitial', ext: 'aar')
implementation(name:'mintegral_interstitialvideo', ext: 'aar')
implementation(name:'mintegral_interactiveads', ext: 'aar')
implementation(name: 'mintegral_mtgbanner', ext: 'aar')
implementation(name: 'mintegral_mtgbid', ext: 'aar')
implementation(name:'mintegral_mtgjscommon', ext: 'aar')
implementation(name:'mintegral_mtgnative', ext: 'aar')
implementation(name:'mintegral_nativeex', ext: 'aar')
implementation(name:'mintegral_playercommon', ext: 'aar')
implementation(name:'mintegral_reward', ext: 'aar')
implementation(name:'mintegral_videocommon', ext: 'aar')
implementation(name:'mintegral_videojs', ext: 'aar')

Remove Mintegral 

Please remove the following files from your project:

  • mintegral-mediation.aar
  • mintegral_common.aar
  • mintegral_interactiveads.aar
  • mintegral_interstitial.aar
  • mintegral_interstitialvideo.aar
  • mintegral_mtgbanner.aar
  • mintegral_mtgbid.aar
  • mintegral_mtgjscommon.aar
  • mintegral_mtgnative.aar
  • mintegral_nativeex.aar
  • mintegral_playercommon.aar
  • mintegral_reward.aar
  • mintegral_videocommon.aar
  • mintegral_videojs.aar

In app level “build.gradle”, remove ConsoliAds Mintegral mediation in dependencies.

implementation(name:'mintegral-mediation', ext:'aar')
implementation(name:'mintegral_common', ext: 'aar')
implementation(name:'mintegral_interstitial', ext: 'aar')
implementation(name:'mintegral_interstitialvideo', ext: 'aar')
implementation(name:'mintegral_interactiveads', ext: 'aar')
implementation(name: 'mintegral_mtgbanner', ext: 'aar')
implementation(name: 'mintegral_mtgbid', ext: 'aar')
implementation(name:'mintegral_mtgjscommon', ext: 'aar')
implementation(name:'mintegral_mtgnative', ext: 'aar')
implementation(name:'mintegral_nativeex', ext: 'aar')
implementation(name:'mintegral_playercommon', ext: 'aar')
implementation(name:'mintegral_reward', ext: 'aar')
implementation(name:'mintegral_videocommon', ext: 'aar')
implementation(name:'mintegral_videojs', ext: 'aar')

Mopub

Add Mopub

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Mopub mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
  • mopub-mediation.aar
  • mopub-sdk-5.15.0.aar
  • mopub-sdk-banner-5.15.0.aar
  • mopub-sdk-base-5.15.0.aar
  • mopub-sdk-fullscreen-5.15.0.aar
  • mopub-sdk-native-static-5.15.0.aar
  • Mopub-volley-2.1.0.aar
  • omsdk-android-1.3.4.aar

In app level “build.gradle”, add ConsoliAds Mopub mediation in dependencies.

implementation(name: 'mopub-mediation', ext:'aar')
implementation(name: 'mopub-sdk-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-base-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-banner-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-fullscreen-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-native-static-5.15.0', ext: 'aar')
implementation(name: 'mopub-volley-2.1.0', ext: 'aar')
implementation(name: 'omsdk-android-1.3.4', ext: 'aar')
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.media2:media2-player:1.0.2"
implementation "androidx.media2:media2-session:1.0.2"
implementation "androidx.media2:media2-widget:1.0.2"
implementation "androidx.core:core-ktx:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71"

Remove Mopub

Please remove the following files from your project:

  • mopub-mediation.aar
  • mopub-sdk-5.15.0.aar
  • mopub-sdk-banner-5.15.0.aar
  • mopub-sdk-base-5.15.0.aar
  • mopub-sdk-fullscreen-5.15.0.aar
  • mopub-sdk-native-static-5.15.0.aar
  • Mopub-volley-2.1.0.aar
  • omsdk-android-1.3.4.aar

In app level “build.gradle”, remove ConsoliAds Mopub mediation in dependencies.

implementation(name: 'mopub-mediation', ext:'aar')
implementation(name: 'mopub-sdk-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-base-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-banner-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-fullscreen-5.15.0', ext: 'aar')
implementation(name: 'mopub-sdk-native-static-5.15.0', ext: 'aar')
implementation(name: 'mopub-volley-2.1.0', ext: 'aar')
implementation(name: 'omsdk-android-1.3.4', ext: 'aar')
implementation "androidx.annotation:annotation:1.1.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.media2:media2-player:1.0.2"
implementation "androidx.media2:media2-session:1.0.2"
implementation "androidx.media2:media2-widget:1.0.2"
implementation "androidx.core:core-ktx:1.1.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.71"

StartApp

Add StartApp

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds StartApp mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy following files into libs directory:
  • startapp-mediation.aar

In app level “build.gradle”, add ConsoliAds StartApp mediation in dependencies.

implementation(name:'startapp-mediation', ext:'aar')

Remove StartApp 

Please remove the following files from your project:

  • startapp-mediation.aar

In app level “build.gradle”, remove ConsoliAds StartApp mediation in dependencies.

implementation(name:'startapp-mediation', ext:'aar')

Tapjoy

Add Tapjoy

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Tapjoy mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    • tapjoy-mediation.aar

In app level “build.gradle”, add ConsoliAds Tapjoy mediation in dependencies.

implementation (name:'tapjoy-mediation', ext:'aar')

Remove Tapjoy 

Please remove the following files from your project:

  • tapjoy-mediation.aar

In app level “build.gradle”, remove ConsoliAds Tapjoy mediation in dependencies.

implementation (name:'tapjoy-mediation', ext:'aar')

Vungle

Add Vungle

  1. Make sure that the latest ConsoliAds Mediation SDK is integrated in your android project.
  2. Go to ConsoliAds portal and download ConsoliAds Vungle mediation SDK (https://portal.consoliads.com/download/adnetworksdk/Android).
  3. Copy the following files into libs directory:
    • vungle-mediation.aar
    • vungle-android-sdk-6.9.1.aar

In app level “build.gradle”, add ConsoliAds Vungle mediation in dependencies.

implementation (name:'vungle-mediation', ext:'aar')
implementation(name: 'vungle-android-sdk-6.9.1', ext: 'aar')

Remove Vungle

Please remove the following files from your project:

  • vungle-mediation.aar
  • vungle-android-sdk-6.9.1.aar

In app level “build.gradle”, remove ConsoliAds Vungle mediation in dependencies.

implementation (name:'vungle-mediation', ext:'aar')
implementation(name: 'vungle-android-sdk-6.9.1', ext: 'aar')

More Help Sources of Integration

ConsoliAds Sample Project:

You can download the sample project from https://portal.consoliads.com/download/Android to see complete ConsoliAds integration already implemented for all ad formats.

Youtube Videos:

You can watch short integrations videos on your youtube channel, https://www.youtube.com/watch?v=nExp4zfb0xc, to further explore integrations with ConsoliAds.

ConsoliAds GitHub forum

If you are having any technical issues, you can visit https://github.com/teamconsoliads/sampleapp-android to view known issues, share problems and suggestions.

Was this article helpful?
Dislike 0