Search in sources :

Example 1 with AdvertisingId

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

Context (android.content.Context)1 AdvertisingId (com.mopub.common.privacy.AdvertisingId)1 ConsentData (com.mopub.common.privacy.ConsentData)1 ConsentStatus (com.mopub.common.privacy.ConsentStatus)1 PersonalInfoManager (com.mopub.common.privacy.PersonalInfoManager)1 ArrayList (java.util.ArrayList)1