Android AdMob Mediation Adapter supports all our ad units including the unique Interscroller ad unit.
AdMob/ display.io ad units mapping:
|
display.io |
AdMob |
|
 |
Interscroller |
Banner |
 |
 |
Headline |
Banner |
 |
 |
Interstitial |
Interstitial |
 |
 |
Infeed |
Banner |
 |
 |
Medium Rectangle |
Banner |
 |
 |
Banner |
Banner |
 |
To set it up:
1. Add the adapter to your project.
Edit your project’s build.gradle file in order to declare our maven repository:
repositories {
google()
jcenter()
maven { url "https://maven.display.io/" }
}
Add the following dependencies to your app-module’s build.gradle file:
implementation ‘com.brandio.ads:sdk:4.6.6.3’
implementation ‘com.brandio.ads:google-ads-adapter:4.6.5'
Follow guide to initialize DisplayIO SDK.
2. Create a Google AdMob account and register an app.
3. Use Quick start from Google to setup AdMob SDK.
4. Create a mediation group.
5. In Ad sources section switch off AdMob Network and add a custom event for each ad unit using Class Name com.brandio.ads.adapters.googleads.InterstitialAdapter for Interstitial ad unit or com.brandio.ads.adapters.googleads.InfeedAdapter for Infeed ad unit or com.brandio.ads.adapters.googleads.InterscrollerAdapter for Interscroller ad unit or com.brandio.ads.adapters.googleads.BannerAdapter for Banner ad unit or com.brandio.ads.adapters.googleads.MediumRectangleAdapter for Medium Rectangle ad unit or com.brandio.ads.adapters.googleads.HeadlineAdapter for Headline ad unit
and Parameter: <PLACEMENT_ID> where <PLACEMENT_ID> parameter taken from display.io apps page.

Note: Interscroller unit also requires position of ad in your RecyclerView custom event data:

6. Use Banner(Infeed) or Interstitial tutorials to get ads from AdMob.
7. Infeed could be added in RecyclerView by passing it as adapter’s constructor argument:
RecyclerViewAdapter( ... , @NonNull AdView adView) {
...
this.adView = adView;
}
And be shown in particular position with help of RecyclerView.ViewHolder subclass in RecyclerView.Adapter.onCreateViewHolder method:
...
static class AdHolder extends RecyclerView.ViewHolder {
AdHolder(View itemView) {
super(itemView);
}
}
...
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final
ViewGroup parent, int viewType) {
...
return new AdHolder(adView);
}
...
9. Interscroller could be added in RecyclerView like Banner but it require additional step: Set up your placement with field to store reference to parent (RecyclerView object) Make sure you call it after DisplayIO SDK has beed initialized:
try {
InterscrollerPlacement placement = (InterscrollerPlacement) Controller
.getInstance().getPlacement(IS_PLACEMENT_ID);
placement.setParentRecyclerView(recyclerView);
} catch (DioSdkException e) {
e.printStackTrace();
}
Android AppLovin Mediation Adapter
Android AppLovin Mediation Adapter can be used to serve DisplayIO ads through AppLovin SDK and can be managed in AppLovin dashboard.
To set it up:
1. Add new network in AppLovin dashboard according to manual:

2. Create new ad unit (or use existing) in AppLovin dashboard according to manual. Enable DisplayIO network for this unit and apply desired settings to adjust waterfall.

3. Add the following dependencies to your app-module’s build.gradle file:
implementation ‘com.brandio.ads:sdk:4.6.6.3’
4. Build a custom adapter according to manual. Refer to “Request Ad” and “Load Ad” sections to find step-by-step manual for DisplayIO integration and get code snippets to be inserted to your custom adapter class. It is important to name adapter class explicitly as you specified in DisplayIO network settings. Here is the example for custom adapter between DisplayIO and AppLovin networks:
Kotlin sample:
class DisplayIOMediationAdapter(sdk: AppLovinSdk?) : MediationAdapterBase(sdk), MaxAdViewAdapter,
MaxInterstitialAdapter {
private var interstitialDIOAd: Ad? = null
companion object {
const val APP_ID = "YOUR_APP_ID"
}
override fun initialize(
params: MaxAdapterInitializationParameters?,
activity: Activity?,
listener: MaxAdapter.OnCompletionListener?
) {
if (!Controller.getInstance().isInitialized) {
listener?.onCompletion(
MaxAdapter.InitializationStatus.INITIALIZING,
null
)
runOnUiThread {
Controller.getInstance().init(
activity!!,
null,
Companion.APP_ID,
object : SdkInitListener {
override fun onInit() {
listener?.onCompletion(
MaxAdapter.InitializationStatus.INITIALIZED_SUCCESS,
null
)
Toast.makeText(activity, "DIO Initialized!", Toast.LENGTH_SHORT).show()
}
override fun onInitError(p0: DIOError?) {
listener?.onCompletion(
MaxAdapter.InitializationStatus.INITIALIZED_FAILURE,
null
)
}
}
)
}
} else {
listener?.onCompletion(
MaxAdapter.InitializationStatus.INITIALIZED_SUCCESS,
null
)
}
}
override fun getSdkVersion(): String {
return Controller.getInstance().ver
}
override fun getAdapterVersion(): String {
return Controller.getInstance().ver
}
override fun onDestroy() {
Controller.getInstance().onDestroy()
}
override fun loadAdViewAd(
parameters: MaxAdapterResponseParameters?,
format: MaxAdFormat?,
activity: Activity?,
listener: MaxAdViewAdapterListener?
) {
if (!Controller.getInstance().isInitialized) {
Log.e("Adapter", "DIO SDK is not initialized!")
listener?.onAdViewAdLoadFailed(MaxAdapterError.UNSPECIFIED)
return
}
if (activity == null) {
listener?.onAdViewAdLoadFailed(MaxAdapterError.UNSPECIFIED)
return
}
val plcID = parameters?.thirdPartyAdPlacementId
requestAndLoadDisplayIOAd(
plcID,
listener,
null,
activity
)
}
private fun requestAndLoadDisplayIOAd(
plcID: String?,
listener: MaxAdViewAdapterListener?,
interstitialListener: MaxInterstitialAdapterListener?,
activity: Activity?
) {
// check type of the placement before cast to BannerPlacement or any other
var placement = try {
Controller.getInstance().getPlacement(plcID)
} catch (e: Exception) {
listener?.onAdViewAdLoadFailed(MaxAdapterError.INTERNAL_ERROR)
return
}
val adRequest = placement.newAdRequest()
adRequest.setAdRequestListener(object : AdRequestListener {
override fun onAdReceived(adProvider: AdProvider?) {
adProvider?.setAdLoadListener(object : AdLoadListener {
override fun onLoaded(ad: Ad?) {
var adView: View? = null
// check type of the placement before retrieve ad view
// can be also checked with placement IDs
when (placement) {
is BannerPlacement -> {
adView = placement.getBanner(
activity,
adRequest.id
)
}
is MediumRectanglePlacement -> {
adView = placement.getMediumRectangle(
activity,
adRequest.id
)
}
is InfeedPlacement -> {
adView = InfeedAdContainer.getAdView(activity)
val infeedContainer =
placement.getInfeedContainer(activity, adRequest.id)
infeedContainer.bindTo(adView)
}
is InterstitialPlacement -> {
interstitialDIOAd = ad
interstitialListener?.onInterstitialAdLoaded()
return
}
}
if (adView != null) {
listener?.onAdViewAdLoaded(adView)
} else {
listener?.onAdViewAdLoadFailed(MaxAdapterError.NO_FILL)
}
}
override fun onFailedToLoad(p0: DIOError?) {
listener?.onAdViewAdLoadFailed(MaxAdapterError.UNSPECIFIED)
interstitialListener?.onInterstitialAdLoadFailed(MaxAdapterError.UNSPECIFIED)
}
})
adProvider!!.loadAd()
}
override fun onNoAds(e: DIOError?) {
listener?.onAdViewAdLoadFailed(MaxAdapterError.NO_FILL)
interstitialListener?.onInterstitialAdLoadFailed(MaxAdapterError.NO_FILL)
}
})
adRequest.requestAd()
}
override fun loadInterstitialAd(
parameters: MaxAdapterResponseParameters?,
activity: Activity?,
listener: MaxInterstitialAdapterListener?
) {
val plcID = parameters?.thirdPartyAdPlacementId
requestAndLoadDisplayIOAd(
plcID,
null,
listener,
activity
)
}
override fun showInterstitialAd(
parameters: MaxAdapterResponseParameters?,
activity: Activity?,
listener: MaxInterstitialAdapterListener?
) {
if (interstitialDIOAd != null){
interstitialDIOAd!!.setEventListener(object : AdEventListener() {
override fun onShown(p0: Ad?) {
listener?.onInterstitialAdDisplayed()
}
override fun onFailedToShow(p0: Ad?) {
listener?.onInterstitialAdDisplayFailed(MaxAdapterError.AD_DISPLAY_FAILED)
}
override fun onClicked(p0: Ad?) {
listener?.onInterstitialAdClicked()
}
override fun onClosed(p0: Ad?) {
listener?.onInterstitialAdHidden()
}
})
interstitialDIOAd!!.showAd(activity)
}
}
}