Search in sources :

Example 1 with LoadListener

use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventBanner method onLoad.

@Override
public void onLoad(@NonNull MyTargetView myTargetView) {
    MoPubLog.log(getAdNetworkId(), CUSTOM, ADAPTER_NAME, "myTarget banner ad loaded " + "successfully. Showing ad...");
    LoadListener loadListener = mLoadListener;
    if (loadListener != null) {
        loadListener.onAdLoaded();
        MoPubLog.log(getAdNetworkId(), LOAD_SUCCESS, ADAPTER_NAME);
    }
}
Also used : LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener)

Example 2 with LoadListener

use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventInterstitial method load.

@Override
protected void load(@NonNull final Context context, @NonNull final AdData adData) {
    setAutomaticImpressionAndClickTracking(false);
    final Map<String, String> extras = adData.getExtras();
    String sslotId = extras.get(MyTargetAdapterConfiguration.SLOT_ID_KEY);
    int slotId = MyTargetAdapterUtils.parseSlot(sslotId);
    if (slotId < 0) {
        LoadListener loadListener = mLoadListener;
        if (loadListener != null) {
            loadListener.onAdLoadFailed(MoPubErrorCode.NETWORK_NO_FILL);
            MoPubLog.log(getAdNetworkId(), LOAD_FAILED, ADAPTER_NAME, MoPubErrorCode.NETWORK_NO_FILL.getIntCode(), MoPubErrorCode.NETWORK_NO_FILL);
        }
        return;
    }
    adNetworkId = sslotId != null ? sslotId : "";
    MyTargetAdapterUtils.handleConsent();
    interstitialAd = new InterstitialAd(slotId, context);
    final String adMarkup = extras.get(DataKeys.ADM_KEY);
    MopubCustomParamsUtils.fillCustomParams(interstitialAd.getCustomParams(), extras);
    interstitialAd.setListener(this);
    if (adMarkup == null || adMarkup.length() == 0) {
        interstitialAd.load();
    } else {
        interstitialAd.loadFromBid(adMarkup);
    }
    MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
Also used : LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener) InterstitialAd(com.my.target.ads.InterstitialAd)

Example 3 with LoadListener

use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventInterstitial method onNoAd.

@Override
public void onNoAd(@NonNull String reason, @NonNull InterstitialAd ad) {
    MoPubLog.log(getAdNetworkId(), CUSTOM, ADAPTER_NAME, "myTarget banner ad failed " + "to load.");
    MoPubErrorCode code = NETWORK_NO_FILL;
    MoPubLog.log(getAdNetworkId(), AdLogEvent.LOAD_FAILED, ADAPTER_NAME, code.getIntCode(), code);
    LoadListener loadListener = mLoadListener;
    InteractionListener interactionListener = mInteractionListener;
    if (interactionListener == null && loadListener != null) {
        loadListener.onAdLoadFailed(code);
    } else if (interactionListener != null) {
        interactionListener.onAdFailed(code);
    }
}
Also used : InteractionListener(com.mopub.mobileads.AdLifecycleListener.InteractionListener) LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener)

Example 4 with LoadListener

use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventInterstitial method onLoad.

@Override
public void onLoad(@NonNull InterstitialAd ad) {
    LoadListener loadListener = mLoadListener;
    if (loadListener != null) {
        loadListener.onAdLoaded();
        MoPubLog.log(getAdNetworkId(), LOAD_SUCCESS, ADAPTER_NAME);
    }
}
Also used : LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener)

Example 5 with LoadListener

use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventRewardedVideo method onLoad.

@Override
public void onLoad(@NonNull RewardedAd ad) {
    LoadListener loadListener = mLoadListener;
    if (loadListener != null) {
        loadListener.onAdLoaded();
        MoPubLog.log(getAdNetworkId(), LOAD_SUCCESS, ADAPTER_NAME);
    }
}
Also used : LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener)

Aggregations

LoadListener (com.mopub.mobileads.AdLifecycleListener.LoadListener)9 InteractionListener (com.mopub.mobileads.AdLifecycleListener.InteractionListener)3 MoPubErrorCode (com.mopub.mobileads.MoPubErrorCode)1 InterstitialAd (com.my.target.ads.InterstitialAd)1 MyTargetView (com.my.target.ads.MyTargetView)1 AdSize (com.my.target.ads.MyTargetView.AdSize)1 RewardedAd (com.my.target.ads.RewardedAd)1