Search in sources :

Example 1 with RewardedAd

use of com.my.target.ads.RewardedAd in project mytarget-android by myTargetSDK.

the class MyTargetMopubCustomEventRewardedVideo 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();
    rewardedAd = new RewardedAd(slotId, context);
    final String adMarkup = extras.get(DataKeys.ADM_KEY);
    MopubCustomParamsUtils.fillCustomParams(rewardedAd.getCustomParams(), extras);
    rewardedAd.setListener(this);
    if (adMarkup == null || adMarkup.length() == 0) {
        rewardedAd.load();
    } else {
        rewardedAd.loadFromBid(adMarkup);
    }
    MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
Also used : LoadListener(com.mopub.mobileads.AdLifecycleListener.LoadListener) RewardedAd(com.my.target.ads.RewardedAd)

Aggregations

LoadListener (com.mopub.mobileads.AdLifecycleListener.LoadListener)1 RewardedAd (com.my.target.ads.RewardedAd)1