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()
mavenCentral()
maven { url "https://maven.display.io/" }
}
Add the following dependencies to your app-module’s build.gradle file:
implementation ‘com.brandio.ads:sdk:5.0.0’
implementation ‘com.brandio.ads:google-ads-adapter:5.0.0'
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. Do not forget to set your Display.io PLACEMENT_ID and APP_ID.
3. Add adapter between AppLoin and DisplayIO to your project:
implementation ("com.applovin.mediation.adapters:applovin-adapter:5.0.0")
Alternative way is to download custom adaptor from repository. Include DisplayIOMediationAdapter class to you project. It is important to have adaptor class name and package name explicitly as you specified in DisplayIO network settings. Refer to Android sample application for working example of custom adaptor implementation.
4. Import DisplayIO SDK to your project following simple steps according to manual.
5. Starting from SDK 5.0.0 you can set additional data to your ad request. The supported data aligned with oRTB specification.
AdRequest adRequest = new AdRequestBuilder(new AdRequest())
.setBidFloor(55.8)
.setUserId("USER_123")
.build();
// add custom ad request data to interstitial ad
maxInterstitialAd.setLocalExtraParameter(DIO_AD_REQUEST, adRequest);
// add custom ad request data to banner/mrect
maxAdView.setLocalExtraParameter(DIO_AD_REQUEST, adRequest);
Refer to request ads section to learn more about supported ad request data.