use of com.mopub.common.privacy.PersonalInfoManager 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);
}
use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class VungleRouter method initVungle.
void initVungle(final Context context, final String vungleAppId) {
// Pass the user consent from the MoPub SDK to Vungle as per GDPR
// Pass consentMessageVersion per Vungle 6.3.17:
// https://support.vungle.com/hc/en-us/articles/360002922871#GDPRRecommendedImplementationInstructions
InitCallback initCallback = new InitCallback() {
@Override
public void onSuccess() {
MoPubLog.log(CUSTOM, ADAPTER_NAME, "SDK is initialized successfully.");
sInitState = SDKInitState.INITIALIZED;
clearWaitingList();
// Pass the user consent from the MoPub SDK to Vungle as per GDPR
PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
boolean canCollectPersonalInfo = MoPub.canCollectPersonalInformation();
boolean shouldAllowLegitimateInterest = MoPub.shouldAllowLegitimateInterest();
if (personalInfoManager != null && personalInfoManager.gdprApplies() == Boolean.TRUE) {
if (shouldAllowLegitimateInterest) {
if (personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.EXPLICIT_NO || personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.DNT || personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.POTENTIAL_WHITELIST) {
Vungle.updateConsentStatus(Vungle.Consent.OPTED_OUT, "");
} else {
Vungle.updateConsentStatus(Vungle.Consent.OPTED_IN, "");
}
} else {
// Pass consentMessageVersion per Vungle 6.3.17:
// https://support.vungle.com/hc/en-us/articles/360002922871#GDPRRecommendedImplementationInstructions
Vungle.updateConsentStatus(canCollectPersonalInfo ? Vungle.Consent.OPTED_IN : Vungle.Consent.OPTED_OUT, "");
}
}
}
@Override
public void onError(VungleException throwable) {
MoPubLog.log(CUSTOM_WITH_THROWABLE, "Initialization failed.", throwable);
sInitState = SDKInitState.NOTINITIALIZED;
}
@Override
public void onAutoCacheAdAvailable(String placementId) {
// no-op
}
};
VungleSettings vungleSettings = VungleNetworkSettings.getVungleSettings();
VungleSettings settings = (vungleSettings != null) ? vungleSettings : new VungleSettings.Builder().build();
Vungle.init(vungleAppId, context.getApplicationContext(), initCallback, settings);
sInitState = SDKInitState.INITIALIZING;
}
Aggregations