package com.appnext.appnextsdk;
import android.content.Context;
import android.os.Bundle;
import com.google.android.gms.ads.mediation.MediationAdRequest;
import com.google.android.gms.ads.mediation.customevent.CustomEventInterstitial;
import com.google.android.gms.ads.mediation.customevent.CustomEventInterstitialListener;
public class AppnextAdMobAdapter implements CustomEventInterstitial {
private CustomEventInterstitialListener mCustomEventInterstitialListener;
private String mPlacementId;
private Context mContext;
@Override
public void onDestroy() {
}
@Override
public void onPause() {
}
@Override
public void onResume() {
}
@Override
public void requestInterstitialAd(Context context,
CustomEventInterstitialListener listener,
String serverParameter,
MediationAdRequest mediationAdRequest,
Bundle customEventExtras) {
mContext = context;
mPlacementId = serverParameter;
mCustomEventInterstitialListener = listener;
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdLoaded();
}
@Override
public void showInterstitial() {
PopupActivity.setAdLoadInterface(new OnAdLoadInterface() {
@Override
public void adLoaded() {
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdLoaded();
}
});
PopupActivity.setNoAdsInterface(new NoAdsInterface() {
@Override
public void noAds() {
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdFailedToLoad(0);
}
});
PopupActivity.setPopupOpenedInterface(new PopupOpenedInterface() {
@Override
public void popupOpened() {
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdOpened();
}
});
PopupActivity.setPopupClickedCallback(new PopupClickedInterface() {
@Override
public void popupClicked() {
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdClicked();
}
});
PopupActivity.setPopupClosedCallback(new PopupClosedInterface() {
@Override
public void popupClosed() {
if (mCustomEventInterstitialListener != null)
mCustomEventInterstitialListener.onAdClosed();
}
});
Appnext.showPopupInActivity(mContext, mPlacementId, false);
}
}
Sunday, June 7, 2015
AdMob interstial adapter for Appnext
I needed intergration Appnext into AdMob mediation bt there was not AdMob adapter, so I wrote one. Please note this adapter uses Appnext's Activities & not in-activity popups.
Subscribe to:
Comments (Atom)