use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class TapjoyInterstitial method fetchMoPubGDPRSettings.
// Pass the user consent from the MoPub SDK to Tapjoy as per GDPR
private void fetchMoPubGDPRSettings() {
PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
if (personalInfoManager != null) {
Boolean gdprApplies = personalInfoManager.gdprApplies();
if (gdprApplies != null) {
tjPrivacyPolicy.setSubjectToGDPR(gdprApplies);
if (gdprApplies) {
String userConsented = MoPub.canCollectPersonalInformation() ? "1" : "0";
tjPrivacyPolicy.setUserConsent(userConsented);
} else {
tjPrivacyPolicy.setUserConsent("-1");
}
}
}
}
use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class OguryRewardedVideo 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();
mAdUnitId = OguryAdapterConfiguration.getAdUnitId(extras);
if (TextUtils.isEmpty(mAdUnitId)) {
MoPubLog.log(getAdNetworkId(), CUSTOM, ADAPTER_NAME, "Received invalid Ogury ad " + "unit ID for rewarded ad. 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);
mListenerHelper = new OguryAdListenerHelper(ADAPTER_NAME, mAdUnitId);
mListenerHelper.setLoadListener(mLoadListener);
mOptInVideo = new OguryOptinVideoAd(context, mAdUnitId);
mOptInVideo.setListener(this);
mOptInVideo.setAdImpressionListener(this);
mOptInVideo.load();
MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class TapjoyRewardedVideo method fetchMoPubGDPRSettings.
// Pass the user consent from the MoPub SDK to Tapjoy as per GDPR
private void fetchMoPubGDPRSettings() {
PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
if (personalInfoManager != null) {
Boolean gdprApplies = personalInfoManager.gdprApplies();
if (gdprApplies != null) {
tjPrivacyPolicy.setSubjectToGDPR(gdprApplies);
if (gdprApplies) {
String userConsented = MoPub.canCollectPersonalInformation() ? "1" : "0";
tjPrivacyPolicy.setUserConsent(userConsented);
} else {
tjPrivacyPolicy.setUserConsent("-1");
}
}
}
}
use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class UnityAdsInitializer method initGdpr.
private void initGdpr(Context context) {
// Pass the user consent from the MoPub SDK to Unity Ads as per GDPR
PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
final boolean canCollectPersonalInfo = MoPub.canCollectPersonalInformation();
final boolean shouldAllowLegitimateInterest = MoPub.shouldAllowLegitimateInterest();
if (personalInfoManager != null && personalInfoManager.gdprApplies() == Boolean.TRUE) {
final MetaData gdprMetaData = new MetaData(context);
if (shouldAllowLegitimateInterest) {
if (personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.EXPLICIT_NO || personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.DNT) {
gdprMetaData.set("gdpr.consent", false);
} else {
gdprMetaData.set("gdpr.consent", true);
}
} else {
gdprMetaData.set("gdpr.consent", canCollectPersonalInfo);
}
gdprMetaData.commit();
}
}
use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.
the class MoPubListFragment method onChangeConsent.
/**
* Call this function to grant or revoke user consent
*
* @param consentGranted - true to grant consent, false to revoke
* @return - true successfully completed operation, false failed for some reason
*/
boolean onChangeConsent(final boolean consentGranted) {
final PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
final View view = getView();
if (personalInfoManager == null || view == null) {
MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, getString(R.string.pim_is_not_available));
return false;
}
final EditText text = view.findViewById(R.id.status_change_notification);
text.setVisibility(View.VISIBLE);
if (consentGranted) {
personalInfoManager.grantConsent();
text.setText(R.string.consent_whitelisted);
} else {
if (personalInfoManager.getPersonalInfoConsentStatus().equals(ConsentStatus.DNT)) {
text.setText(R.string.donottrack_text);
return false;
}
personalInfoManager.revokeConsent();
text.setText(R.string.consent_denied);
}
return true;
}
Aggregations