use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.
the class MyTargetMopubCustomEventRewardedVideo method onNoAd.
@Override
public void onNoAd(@NonNull String reason, @NonNull RewardedAd 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);
InteractionListener interactionListener = mInteractionListener;
LoadListener loadListener = mLoadListener;
if (interactionListener == null && loadListener != null) {
loadListener.onAdLoadFailed(code);
} else if (interactionListener != null) {
interactionListener.onAdFailed(code);
}
}
use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.
the class MyTargetMopubCustomEventBanner method load.
@Override
protected void load(@NonNull Context context, @NonNull AdData adData) {
setAutomaticImpressionAndClickTracking(false);
Map<String, String> extras = adData.getExtras();
String sslotId = extras.get(MyTargetAdapterConfiguration.SLOT_ID_KEY);
int slotId = MyTargetAdapterUtils.parseSlot(sslotId);
if (slotId < 0) {
MoPubLog.log(LOAD_FAILED, ADAPTER_NAME, NETWORK_NO_FILL.getIntCode(), NETWORK_NO_FILL);
LoadListener loadListener = mLoadListener;
if (loadListener != null) {
loadListener.onAdLoadFailed(NETWORK_NO_FILL);
}
return;
}
adNetworkId = sslotId != null ? sslotId : "";
MyTargetAdapterUtils.handleConsent();
Integer adHeight = adData.getAdHeight();
Integer adWidth = adData.getAdWidth();
AdSize adSize = calculateSize(adWidth == null ? 0 : adWidth, adHeight == null ? 0 : adHeight, context);
if (myTargetView == null) {
myTargetView = new MyTargetView(context);
MopubCustomParamsUtils.fillCustomParams(myTargetView.getCustomParams(), extras);
myTargetView.setSlotId(slotId);
if (adSize != null) {
myTargetView.setAdSize(adSize);
}
myTargetView.setRefreshAd(false);
myTargetView.setListener(this);
}
final String adMarkup = extras.get(DataKeys.ADM_KEY);
if (adMarkup == null || adMarkup.length() == 0) {
myTargetView.load();
} else {
myTargetView.loadFromBid(adMarkup);
}
MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
use of com.mopub.mobileads.AdLifecycleListener.LoadListener in project mytarget-android by myTargetSDK.
the class MyTargetMopubCustomEventBanner method onNoAd.
@Override
public void onNoAd(@NonNull String reason, @NonNull MyTargetView myTargetView) {
MoPubLog.log(getAdNetworkId(), CUSTOM, ADAPTER_NAME, "myTarget banner ad failed to load.");
MoPubErrorCode code = NETWORK_NO_FILL;
MoPubLog.log(getAdNetworkId(), LOAD_FAILED, ADAPTER_NAME, code.getIntCode(), code);
InteractionListener interactionListener = mInteractionListener;
LoadListener loadListener = mLoadListener;
if (interactionListener == null && loadListener != null) {
loadListener.onAdLoadFailed(code);
} else if (interactionListener != null) {
interactionListener.onAdFailed(code);
}
}
use of com.mopub.mobileads.AdLifecycleListener.LoadListener 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);
}
Aggregations