Search in sources :

Example 1 with ConsentStatus

use of com.mopub.common.privacy.ConsentStatus 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 2 with ConsentStatus

use of com.mopub.common.privacy.ConsentStatus 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

ConsentData (com.mopub.common.privacy.ConsentData)2 ConsentStatus (com.mopub.common.privacy.ConsentStatus)2 PersonalInfoManager (com.mopub.common.privacy.PersonalInfoManager)2 Context (android.content.Context)1 NavigationView (com.google.android.material.navigation.NavigationView)1 AdvertisingId (com.mopub.common.privacy.AdvertisingId)1 ArrayList (java.util.ArrayList)1