I have set up an AdMob mediation in my android app, it's working fine, but I also want AdMob to mediate interstitial ads from the other providers. I was unable to find any help or documentation on that, so I am asking here.
This is the code I have for the banner mediation:
MMSDK.initialize(this);
millennialExtras = new MillennialAdapterExtras();
inmobiExtras = new InMobiAdapterExtras();
mopubExtras = new MoPubExtras();
FlurryAgent.init(this, "some id");
flurryExtras = new FlurryAdapterExtras();
mAdView = (AdView) findViewById(R.id.adView);
adRequest = new AdRequest.Builder()
.addNetworkExtras(millennialExtras)
.addNetworkExtras(inmobiExtras)
.addNetworkExtras(mopubExtras)
.build();
mAdView.loadAd(adRequest);
And then the ads start rolling.
Now for the interstitials, I am trying to do it like this: in onCreate I have this:
interstitialAd = new InterstitialAd(MainActivity.this);
interstitialAd.setAdUnitId("some id");
adRequestInterstitial = new AdRequest.Builder()
.addNetworkExtras(millennialExtras)
.addNetworkExtras(inmobiExtras)
.addNetworkExtras(mopubExtras)
.build();
interstitialAd.loadAd(adRequestInterstitial);
and then I have this button for showing interstitial:
public void showInterstitial(View v) {
interstitialAd.show();
}
My problem is, that I don't know if this is the proper way to do it. I use the same adapter objects for both the AdMob banner and the AdMob interstitial. I have added the needed networks and ad spaces in AdMob dashboard for the interstitial ad space.
So is this way correct?