Last active
December 16, 2015 12:28
-
-
Save jwyseu/5434805 to your computer and use it in GitHub Desktop.
Implementation of class-based integration of tapfortap in mopub as described at https://github.com/mopub/mopub-client/wiki/CustomEventsAndroid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.mopub.mobileads; | |
| import java.util.Map; | |
| import android.content.Context; | |
| import android.util.Log; | |
| import com.tapfortap.Interstitial; | |
| import com.tapfortap.Interstitial.InterstitialListener; | |
| public class TapForTapCustomEventInterstitial extends CustomEventInterstitial implements InterstitialListener { | |
| private Context context; | |
| private CustomEventInterstitialListener customEventInterstitialListener; | |
| @Override | |
| public void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> localExtras, | |
| Map<String, String> serverExtras) { | |
| Interstitial.prepare(context); | |
| Interstitial.setListener(this); | |
| this.context = context; | |
| this.customEventInterstitialListener= customEventInterstitialListener; | |
| } | |
| @Override | |
| public void showInterstitial() { | |
| Interstitial.show(context); | |
| } | |
| @Override | |
| public void onInvalidate() { | |
| } | |
| @Override | |
| public void onDismiss() { | |
| customEventInterstitialListener.onInterstitialDismissed(); | |
| } | |
| @Override | |
| public void onReceiveAd() { | |
| customEventInterstitialListener.onInterstitialLoaded(); | |
| } | |
| @Override | |
| public void onFail(String message) { | |
| Log.e("TapForTap", "Failed load : " + message); | |
| customEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.UNSPECIFIED); | |
| } | |
| @Override | |
| public void onShow() { | |
| customEventInterstitialListener.onInterstitialShown(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment