com.mopub.mobileads.MoPubInterstitial Java Examples

The following examples show how to use com.mopub.mobileads.MoPubInterstitial. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UtilTest.java    From prebid-mobile-android with Apache License 2.0 6 votes vote down vote up
@Test
public void testApplyBidsToMoPubAdobject() throws Exception {
    MoPubView adView = new MoPubView(activity);
    adView.setKeywords("key1:value1,key2:value2");
    HashMap<String, String> bids = new HashMap<>();
    bids.put("hb_pb", "0.50");
    bids.put("hb_cache_id", "123456");
    Util.apply(bids, adView);
    String adViewKeywords = adView.getKeywords();
    assertEquals("hb_pb:0.50,hb_cache_id:123456,key1:value1,key2:value2", adViewKeywords);
    Util.apply(null, adView);
    assertEquals("key1:value1,key2:value2", adView.getKeywords());
    MoPubInterstitial instl = new MoPubInterstitial(activity, "123456");
    instl.setKeywords("key1:value1,key2:value2");
    Util.apply(bids, instl);
    assertEquals("hb_pb:0.50,hb_cache_id:123456,key1:value1,key2:value2", instl.getKeywords());
    Util.apply(null, instl);
    assertEquals("key1:value1,key2:value2", instl.getKeywords());
}
 
Example #2
Source File: MoPubInterstitialAdView.java    From mobile-sdk-android with Apache License 2.0 6 votes vote down vote up
@Override
public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity, String parameter, String uid, TargetingParameters targetingParameters) {
    mpListener = new MoPubListener(mIC, this.getClass().getSimpleName());

    interstitialAd = new MoPubInterstitial(activity, uid);
    interstitialAd.setInterstitialAdListener(mpListener);

    if (targetingParameters != null) {
        // MoPubInterstitial setLocation not supported.
        /*if (targetingParameters.getLocation() != null) {
            interstitialAd.setLocation(targetingParameters.getLocation());
        }*/

        String keywords = MoPubListener.keywordsFromTargetingParameters(targetingParameters);
        interstitialAd.setKeywords(keywords);
    }

    interstitialAd.load();
}
 
Example #3
Source File: UtilTest.java    From prebid-mobile-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testSupportedAdObject() throws Exception {
    MoPubView testView = new MoPubView(activity);
    assertTrue(Util.supportedAdObject(testView));
    assertFalse(Util.supportedAdObject(null));
    MoPubInterstitial interstitial = new MoPubInterstitial(activity, "");
    assertTrue(Util.supportedAdObject(interstitial));
    PublisherAdRequest request = new PublisherAdRequest.Builder().build();
    assertTrue(Util.supportedAdObject(request));
    Object object = new Object();
    assertFalse(Util.supportedAdObject(object));
}
 
Example #4
Source File: MoPubAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onInterstitialFailed(MoPubInterstitial moPubInterstitial,
    MoPubErrorCode moPubErrorCode) {
  String errorSDKMessage = createSDKError(moPubErrorCode);
  Log.w(TAG, errorSDKMessage);
  mMediationInterstitialListener
      .onAdFailedToLoad(MoPubAdapter.this, getMediationErrorCode(moPubErrorCode));
}
 
Example #5
Source File: MoPubListener.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdExpanded();
    }
}
 
Example #6
Source File: UtilTest.java    From prebid-mobile-android with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetClassFromString() throws Exception {
    assertEquals(MoPubView.class, Util.getClassFromString(Util.MOPUB_BANNER_VIEW_CLASS));
    assertEquals(MoPubInterstitial.class, Util.getClassFromString(Util.MOPUB_INTERSTITIAL_CLASS));
    assertEquals(PublisherAdRequest.class, Util.getClassFromString(Util.DFP_AD_REQUEST_CLASS));
}
 
Example #7
Source File: MoPubListener.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
    Clog.d(Clog.mediationLogTag, "MoPub - onInterstitialFailed called for MoPubInterstitial with ErrorCode: " + errorCode);
    handleMPErrorCode(errorCode);
}
 
Example #8
Source File: MoPubListener.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdCollapsed();
    }
}
 
Example #9
Source File: MoPubListener.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdClicked();
    }
}
 
Example #10
Source File: MoPubListener.java    From mobile-sdk-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdLoaded();
    }
}
 
Example #11
Source File: MoPubAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialShown(MoPubInterstitial moPubInterstitial) {
  mMediationInterstitialListener.onAdOpened(MoPubAdapter.this);
}
 
Example #12
Source File: MoPubAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialLoaded(MoPubInterstitial moPubInterstitial) {
  mMediationInterstitialListener.onAdLoaded(MoPubAdapter.this);
}
 
Example #13
Source File: MoPubAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialDismissed(MoPubInterstitial moPubInterstitial) {
  mMediationInterstitialListener.onAdClosed(MoPubAdapter.this);
}
 
Example #14
Source File: MoPubAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialClicked(MoPubInterstitial moPubInterstitial) {
  mMediationInterstitialListener.onAdClicked(MoPubAdapter.this);
  mMediationInterstitialListener.onAdLeftApplication(MoPubAdapter.this);
}
 
Example #15
Source File: MoPubInterstitialAdListener.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void onInterstitialClicked(MoPubInterstitial interstitial) {
  interstitialClick.onNext(MoPubInterstitialAdClickType.INTERSTITIAL_CLICKED);
}
 
Example #16
Source File: MoPubInterstitialAdListener.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
  Logger.getInstance()
      .e("Mopub_Interstitial", errorCode.toString());
}
 
Example #17
Source File: MoPubInterstitialAdListener.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void onInterstitialLoaded(MoPubInterstitial interstitial) {
  interstitialClick.onNext(MoPubInterstitialAdClickType.INTERSTITIAL_LOADED);
}
 
Example #18
Source File: SdkTest.java    From prebid-mobile-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {
    invokeContainsPrebidCreative(false);
}
 
Example #19
Source File: SdkTest.java    From prebid-mobile-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {
    checkResponseForPrebidCreative();
}
 
Example #20
Source File: MoPubInterstitialAdListener.java    From aptoide-client-v8 with GNU General Public License v3.0 2 votes vote down vote up
@Override public void onInterstitialShown(MoPubInterstitial interstitial) {

  }
 
Example #21
Source File: MoPubInterstitialAdListener.java    From aptoide-client-v8 with GNU General Public License v3.0 2 votes vote down vote up
@Override public void onInterstitialDismissed(MoPubInterstitial interstitial) {

  }
 
Example #22
Source File: SdkTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {

}
 
Example #23
Source File: SdkTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {

}
 
Example #24
Source File: SdkTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {

}
 
Example #25
Source File: AdServerTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialDismissed(MoPubInterstitial interstitial) {

}
 
Example #26
Source File: AdServerTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialClicked(MoPubInterstitial interstitial) {

}
 
Example #27
Source File: AdServerTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialShown(MoPubInterstitial interstitial) {

}
 
Example #28
Source File: AdServerTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {

}
 
Example #29
Source File: AdServerTest.java    From prebid-mobile-android with Apache License 2.0 2 votes vote down vote up
@Override
public void onInterstitialLoaded(MoPubInterstitial interstitial) {

}