Initialize

0. GDPR (General Data Protection Regulation)

The GDPR is the European Union's (hereinafter 'EU') data protection law, and service providers must obtain user consent regarding the collection and use of personal data of EU users or equivalent information. This is the procedure required for GDPR compliance and for ad network operations under the regulation.

1. Initialize & GDPR Content UI

During initialization, features are provided to obtain and manage GDPR consent from EU users. In the MainActivity’s onCreate method, call the initialization function before executing any ad-related code.

  • Use the ADX App ID issued by ADX in place of "<ADX_APP_ID>".

  • SDK initialization should be called only once when the app launches and ad requests should be made after SDK initialization is complete.

    • You must request the ad after onCompleted is called.

  • Select one of the items below as the GdprType.

GDPR type

Description

POPUP_LOCATION

Show the consent popup depending on the region (EU region).

POPUP_DEBUG

Show the consent popup regardless of region for testing purposes (DEBUG).

DIRECT_NOT_REQUIRED

Regions where consent is not required (non-EU regions).

DIRECT_DENIED

The user has refused the collection and use of personal data.

DIRECT_CONFIRM

The user has agreed to the collection and use of personal data.

Case 1. Display the GDPR consent screen for users in the EEA

Provides a consent screen that allows users in the European Economic Area (EEA) to choose whether to give consent.

  • In ADXConfiguration, set GdprType to POPUP_LOCATION. Depending on the user’s country, EU users can provide consent through the GDPR Consent UI.

  • If you set GdprType to POPUP_DEBUG, the Consent UI will show regardless of the user’s country.

// ADX initialization settings
ADXConfiguration adxConfiguration = new ADXConfiguration.Builder()
                        .setAppId("<ADX_APP_ID>")
                        .setGdprType(ADXConfiguration.GdprType.POPUP_LOCATION)
                        .setTestDeviceIds(Arrays.asList("")) // UMP Test Device
                        .build();

ADXSdk.getInstance().initialize((Activity) this, adxConfiguration, new ADXSdk.OnInitializedListener() {
        @Override
        public void onCompleted(boolean result, ADXGDPR.ADXConsentState adxConsentState) {
                // Ad initialization completed
        }
});

To test the AdMob UMP GDPR consent screen, the following two settings are required.

1) Go to the AdMob dashboard (https://apps.admob.com) and follow the GDPR message creation guide to create and publish a message. https://support.google.com/admob/answer/10113207?hl=en


2) Check the device ID in the log output below. Enter that identifier string into the In ADXConfiguration parameter used when creating the setTestDeviceIds object, and for the setGdprType POPUP_DEBUG parameter. Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.

<UMP GDPR Consent Screen>

Case 2. Direct Consent State

If your app does not have users in the European Economic Area (EEA) or does not collect personal data as defined by GDPR (e.g., account registration within the app), you must handle consent manually.

  • For regions outside the European Economic Area (EEA) where consent is not required, set GdprType to DIRECT_NOT_REQUIRED in ADXConfiguration.

  • If you conduct a direct consent process for EU regions, set the GdprType according to the result of the consent process.

    • User has agreed to collection and use of personal data: DIRECT_CONFIRM

    • User has refused collection and use of personal data: DIRECT_DENIED

// ADX initialization settings
ADXConfiguration adxConfiguration = new ADXConfiguration.Builder()
                        .setAppId("<ADX_APP_ID>")
                        .setGdprType(ADXConfiguration.GdprType.DIRECT_CONFIRM)
                        .build();

ADXSdk.getInstance().initialize((Activity) this, adxConfiguration, new ADXSdk.OnInitializedListener() {
        @Override
        public void onCompleted(boolean result, ADXGDPR.ADXConsentState adxConsentState) {
                // Ad initialization completed
        }
});

2. Initializing Native Ads

If you call the initialization function and the Native Ad functions in the same Activity,

Before calling the initialization function, call AdxNativeAdFactory’s init() and setAdxViewBinder(). After the initialization function completes, call AdxNativeAdFactory.preloadAd() inside the onCompleted method of the OnInitializedListener.

AdxNativeAdFactory.init(this);

AdxNativeAdFactory.setAdxViewBinder("<NATIVE_AD_UNIT_ID>", new AdxViewBinder.Builder(R.layout.layout_media_native_ad)
        .mediaViewContainerId(R.id.mediaContainerId)
        .iconImageId(R.id.adIconId)
        .titleId(R.id.titleId)
        .adChoiceContainerId(R.id.adChoicesContainerId)
        .callToActionId(R.id.callToActionId)
        .build());

Please refer to the relevant page for how to implement Native Ads.

3. ConsentState

GDPR consent can have one of the following four states.

Status

Description

ADXConsentStateUnknown

Users with no consent status: personalized ads will not be shown.

ADXConsentStateNotRequired

Regions where consent is not required (non-EU regions): personalized ads will be shown.

ADXConsentStateDenied

Users who have refused the collection and use of personal data: personalized ads will not be shown.

ADXConsentStateConfirm

Users who have agreed to the collection and use of personal data: personalized ads will be shown.

To check or update the consent state, use the following functions provided by ADXGdprManager.

// You can check the user's consent information set in ADXGdprManager.
ADXGdprManager.getResultGDPR(this);

// Change the consent status directly.
ADXGdprManager.saveResultGDPR(this, ADXConsentState);

You can redisplay the GDPR consent screen to the user, allowing the consent state to be updated.

ADXSdk.getInstance().showGDPRForm((Activity) this, new ADXSdk.OnPrivacyOptionsFormListener() {
    @Override
    public void onCompleted(boolean result) {
    }
});
  • Call the above method only in response to user input events, such as a button click. Calling it without a user input event may result in unexpected behavior.

  • If the user is not in the European Economic Area (EEA), the GDPR consent screen may not be redisplayed.

  • However, if consent information already exists, the GDPR consent screen may still be displayed even for users outside the EEA.

  • Supported from SDK version 2.6.0.

5. Privacy Policy

You can access the URL of ADX’s Privacy Policy by calling getPrivacyURL in ADXGdprManager.

ADXGdprManager.getPrivacyURL();

6. Enable Debugging Logging

To verify proper integration and mediation during QA, set the logLevel in ADXConfiguration before calling the initialization method.

ADXLogUtil.setLogEnable(true);

7. Child-Directed Settings

If your content is intended for children under COPPA regulations or targets users below the consent age in the European Economic Area (EEA), you must configure AdMob targeting settings before calling the initialization function. For more details, refer to AdMob Targeting: https://developers.google.com/admob/android/targeting?hl=en

Last updated

Was this helpful?