Search in sources :

Example 1 with OguryBannerAdView

use of com.ogury.ed.OguryBannerAdView in project mopub-android-mediation by mopub.

the class OguryBanner method load.

@Override
protected void load(@NonNull Context context, @NonNull AdData adData) {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(adData);
    final PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
    if (personalInfoManager != null) {
        final boolean consentIsUnknown = personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.UNKNOWN;
        final boolean canCollectPersonalInfo = MoPub.canCollectPersonalInformation();
        if (OguryAdapterConfiguration.initialized() && !consentIsUnknown) {
            OguryChoiceManagerExternal.setConsent(canCollectPersonalInfo, OguryAdapterConfiguration.CHOICE_MANAGER_CONSENT_ORIGIN);
        }
    }
    setAutomaticImpressionAndClickTracking(false);
    final Map<String, String> extras = adData.getExtras();
    final OguryBannerAdSize adSize = getBannerAdSize(adData.getAdWidth(), adData.getAdHeight());
    mAdUnitId = OguryAdapterConfiguration.getAdUnitId(extras);
    if (TextUtils.isEmpty(mAdUnitId) || adSize == null) {
        if (adSize == null) {
            MoPubLog.log(CUSTOM, ADAPTER_NAME, "The requested banner size does not fit " + "because Ogury only supports 320x50 and 300x250 sizes. Failing ad request.");
        }
        MoPubLog.log(getAdNetworkId(), LOAD_FAILED, ADAPTER_NAME, MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR.getIntCode(), MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
        if (mLoadListener != null) {
            mLoadListener.onAdLoadFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
        }
        return;
    }
    mOguryAdapterConfiguration.setCachedInitializationParameters(context, extras);
    mBanner = new OguryBannerAdView(context);
    mBanner.setAdUnit(mAdUnitId);
    mBanner.setAdSize(adSize);
    mListenerHelper = new OguryAdListenerHelper(ADAPTER_NAME, mAdUnitId);
    mListenerHelper.setLoadListener(mLoadListener);
    mBanner.setListener(this);
    mBanner.setAdImpressionListener(this);
    mBanner.loadAd();
    MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
Also used : PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager) OguryBannerAdSize(com.ogury.ed.OguryBannerAdSize) OguryBannerAdView(com.ogury.ed.OguryBannerAdView)

Aggregations

PersonalInfoManager (com.mopub.common.privacy.PersonalInfoManager)1 OguryBannerAdSize (com.ogury.ed.OguryBannerAdSize)1 OguryBannerAdView (com.ogury.ed.OguryBannerAdView)1