Search in sources :

Example 1 with PersonalInfoManager

use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.

the class AdColonyAdapterConfiguration method getAdColonyAppOptionsAndSetConsent.

protected static AdColonyAppOptions getAdColonyAppOptionsAndSetConsent(String clientOptions) {
    AdColonyAppOptions adColonyAppOptions = AdColonyAppOptions.getMoPubAppOptions(clientOptions);
    // Pass the user consent from the MoPub SDK to AdColony as per GDPR
    PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
    boolean canCollectPersonalInfo = MoPub.canCollectPersonalInformation();
    boolean shouldAllowLegitimateInterest = MoPub.shouldAllowLegitimateInterest();
    adColonyAppOptions = adColonyAppOptions == null ? new AdColonyAppOptions() : adColonyAppOptions;
    adColonyAppOptions.setMediationNetwork("MoPub", ADAPTER_VERSION);
    if (personalInfoManager != null && personalInfoManager.gdprApplies() == Boolean.TRUE) {
        adColonyAppOptions.setPrivacyFrameworkRequired(AdColonyAppOptions.GDPR, true);
        if (shouldAllowLegitimateInterest) {
            if (personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.EXPLICIT_NO || personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.DNT) {
                adColonyAppOptions.setPrivacyConsentString(AdColonyAppOptions.GDPR, "0");
            } else {
                adColonyAppOptions.setPrivacyConsentString(AdColonyAppOptions.GDPR, "1");
            }
        } else if (canCollectPersonalInfo) {
            adColonyAppOptions.setPrivacyConsentString(AdColonyAppOptions.GDPR, "1");
        } else {
            adColonyAppOptions.setPrivacyConsentString(AdColonyAppOptions.GDPR, "0");
        }
    }
    return adColonyAppOptions;
}
Also used : PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager) AdColonyAppOptions(com.adcolony.sdk.AdColonyAppOptions)

Example 2 with PersonalInfoManager

use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.

the class ChartboostAdapterConfiguration method initializeChartboostSdk.

/**
 * Initialize the Chartboost SDK for the provided application id and app signature.
 */
public static synchronized boolean initializeChartboostSdk(@NonNull Context context, @NonNull Map<String, String> configuration) {
    Preconditions.checkNotNull(context);
    Preconditions.checkNotNull(configuration);
    // Pass the user consent from the MoPub SDK to Chartboost as per GDPR
    PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager();
    final boolean canCollectPersonalInfo = MoPub.canCollectPersonalInformation();
    final boolean shouldAllowLegitimateInterest = MoPub.shouldAllowLegitimateInterest();
    if (personalInfoManager != null && personalInfoManager.gdprApplies() == Boolean.TRUE) {
        if (shouldAllowLegitimateInterest) {
            boolean isExplicitNoConsent = personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.EXPLICIT_NO || personalInfoManager.getPersonalInfoConsentStatus() == ConsentStatus.DNT;
            addChartboostPrivacyConsent(context, !isExplicitNoConsent);
        } else {
            addChartboostPrivacyConsent(context, canCollectPersonalInfo);
        }
    }
    // Validate Chartboost args
    if (!configuration.containsKey(APP_ID_KEY)) {
        MoPubLog.log(LOAD_FAILED, ADAPTER_NAME, MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR.getIntCode(), MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
        throw new IllegalStateException("Chartboost rewarded video initialization" + " failed due to missing application ID.");
    }
    if (!configuration.containsKey(APP_SIGNATURE_KEY)) {
        MoPubLog.log(LOAD_FAILED, ADAPTER_NAME, MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR.getIntCode(), MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR);
        throw new IllegalStateException("Chartboost rewarded video initialization" + " failed due to missing application signature.");
    }
    boolean initStarted = Chartboost.isSdkStarted();
    boolean initConfigExists = false;
    final String appId = configuration.get(APP_ID_KEY);
    final String appSignature = configuration.get(APP_SIGNATURE_KEY);
    if (!TextUtils.isEmpty(appId) && !TextUtils.isEmpty(appSignature)) {
        if (appId.equals(mAppId) && appSignature.equals(mAppSignature)) {
            initConfigExists = true;
        }
    } else {
        // AppId or AppSignature is empty, fail initialization.
        return false;
    }
    // For any other case, reinitialize
    if (initConfigExists && initStarted) {
        return true;
    }
    mAppId = appId;
    mAppSignature = appSignature;
    // Perform all the common SDK initialization steps including startAppWithId
    Chartboost.startWithAppId(context, mAppId, mAppSignature);
    Chartboost.setMediation(Chartboost.CBMediation.CBMediationMoPub, MoPub.SDK_VERSION, new ChartboostAdapterConfiguration().getAdapterVersion());
    Chartboost.setDelegate(sDelegate);
    Chartboost.setAutoCacheAds(false);
    return true;
}
Also used : PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager)

Example 3 with PersonalInfoManager

use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.

the class OguryInterstitial 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 interstitial. 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);
    mInterstitial = new OguryInterstitialAd(context, mAdUnitId);
    mInterstitial.setListener(this);
    mInterstitial.setAdImpressionListener(this);
    mInterstitial.load();
    MoPubLog.log(getAdNetworkId(), LOAD_ATTEMPTED, ADAPTER_NAME);
}
Also used : PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager) OguryInterstitialAd(com.ogury.ed.OguryInterstitialAd)

Example 4 with PersonalInfoManager

use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.

the class MoPubSampleActivity method syncNavigationMenu.

private void syncNavigationMenu() {
    final NavigationView navigationView = findViewById(R.id.nav_view);
    SampleActivityInternalUtils.updateEndpointMenu(navigationView.getMenu());
    final PersonalInfoManager manager = MoPub.getPersonalInformationManager();
    if (manager != null) {
        final ConsentData consentData = manager.getConsentData();
        navigationView.getMenu().findItem(R.id.nav_force_gdpr).setChecked(consentData.isForceGdprApplies());
        final ConsentStatus consentStatus = manager.getPersonalInfoConsentStatus();
        if (consentStatus.equals(ConsentStatus.POTENTIAL_WHITELIST)) {
            navigationView.getMenu().findItem(R.id.nav_privacy_grant).setChecked(true);
        } else if (consentStatus.equals(ConsentStatus.EXPLICIT_NO)) {
            navigationView.getMenu().findItem(R.id.nav_privacy_revoke).setChecked(true);
        }
    }
}
Also used : PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager) NavigationView(com.google.android.material.navigation.NavigationView) ConsentStatus(com.mopub.common.privacy.ConsentStatus) ConsentData(com.mopub.common.privacy.ConsentData)

Example 5 with PersonalInfoManager

use of com.mopub.common.privacy.PersonalInfoManager in project mopub-android-mediation by mopub.

the class PrivacyInfoFragment method readPrivacySettings.

private List<PrivacyItem> readPrivacySettings() {
    final PersonalInfoManager manager = MoPub.getPersonalInformationManager();
    final Context context = getContext();
    if (manager == null || context == null) {
        return new ArrayList<>();
    }
    final ConsentData consentData = manager.getConsentData();
    final ConsentStatus status = manager.getPersonalInfoConsentStatus();
    final Boolean gdprApplies = manager.gdprApplies();
    final AdvertisingId advertisingId = ClientMetadata.getInstance(context).getMoPubIdentifier().getAdvertisingInfo();
    final String gdprAppliesString = (gdprApplies == null || gdprApplies) ? "true" : "false";
    final String checkmarkUnicode = "\u2705";
    final String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
    ArrayList<PrivacyItem> list = new ArrayList<>();
    list.add(new PrivacyItem("", "", "Identifiers"));
    list.add(new PrivacyItem("MoPub ID", String.format("\n%s", advertisingId.getIdentifier(false)), manager.canCollectPersonalInformation() ? "" : checkmarkUnicode));
    list.add(new PrivacyItem("Advertising ID", String.format("\n%s", advertisingId.getIdentifier(true)), manager.canCollectPersonalInformation() ? checkmarkUnicode : ""));
    list.add(new PrivacyItem("Android ID", androidId, ""));
    list.add(new PrivacyItem("", "", "Allowable Data Collection"));
    list.add(new PrivacyItem("Is GDPR applicable?", gdprAppliesString, ""));
    list.add(new PrivacyItem("Consent Status", status.getValue(), ""));
    list.add(new PrivacyItem("Can Collect PII", manager.canCollectPersonalInformation() ? "true" : "false", ""));
    list.add(new PrivacyItem("Should Show Consent Dialog", manager.shouldShowConsentDialog() ? "true" : "false", ""));
    list.add(new PrivacyItem("Is Whitelisted", status.equals(ConsentStatus.POTENTIAL_WHITELIST) ? "true" : "false", ""));
    list.add(new PrivacyItem("DNT Enabled", String.format("\n%s", advertisingId.isDoNotTrack()), ""));
    list.add(new PrivacyItem("", "", "Current Versions"));
    list.add(new PrivacyItem("Current Vendor List Url", "", consentData.getCurrentVendorListLink()));
    list.add(new PrivacyItem("Current Vendor List Version", consentData.getCurrentVendorListVersion(), ""));
    list.add(new PrivacyItem("Current Privacy Policy Url", "", consentData.getCurrentPrivacyPolicyLink()));
    list.add(new PrivacyItem("Current Privacy Policy Version", consentData.getCurrentPrivacyPolicyVersion(), ""));
    list.add(new PrivacyItem("Current IAB Vendor List Format", consentData.getCurrentVendorListIabFormat(), ""));
    list.add(new PrivacyItem("", "", "Consented Versions"));
    list.add(new PrivacyItem("Consented Vendor List Version", consentData.getConsentedVendorListVersion(), ""));
    list.add(new PrivacyItem("Consented Privacy Policy Version", consentData.getConsentedPrivacyPolicyVersion(), ""));
    list.add(new PrivacyItem("Consented IAB Vendor List Version", consentData.getConsentedVendorListIabFormat(), ""));
    return list;
}
Also used : Context(android.content.Context) PersonalInfoManager(com.mopub.common.privacy.PersonalInfoManager) ConsentStatus(com.mopub.common.privacy.ConsentStatus) ArrayList(java.util.ArrayList) AdvertisingId(com.mopub.common.privacy.AdvertisingId) ConsentData(com.mopub.common.privacy.ConsentData)

Aggregations

PersonalInfoManager (com.mopub.common.privacy.PersonalInfoManager)12 ConsentData (com.mopub.common.privacy.ConsentData)2 ConsentStatus (com.mopub.common.privacy.ConsentStatus)2 Context (android.content.Context)1 View (android.view.View)1 EditText (android.widget.EditText)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 AdColonyAppOptions (com.adcolony.sdk.AdColonyAppOptions)1 NavigationView (com.google.android.material.navigation.NavigationView)1 AdvertisingId (com.mopub.common.privacy.AdvertisingId)1 OguryBannerAdSize (com.ogury.ed.OguryBannerAdSize)1 OguryBannerAdView (com.ogury.ed.OguryBannerAdView)1 OguryInterstitialAd (com.ogury.ed.OguryInterstitialAd)1 OguryOptinVideoAd (com.ogury.ed.OguryOptinVideoAd)1 MediationMetaData (com.unity3d.ads.metadata.MediationMetaData)1 MetaData (com.unity3d.ads.metadata.MetaData)1 InitCallback (com.vungle.warren.InitCallback)1 VungleSettings (com.vungle.warren.VungleSettings)1 VungleException (com.vungle.warren.error.VungleException)1