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.
In the ADX SDK, you can handle GDPR consent from users.
As of January 16, 2024, IAB Europe requires that consent management be handled through a Consent Management Platform (CMP) certified by platform vendors. Therefore, the GDPR consent screen previously provided internally by the Unity ADX SDK is no longer supported, and GDPR consent must now be managed through AdMob UMP (User Messaging Platform).
If you are servicing, or plan to service, an application in the European Economic Area (EEA), follow the instructions in this document to configure the UMP (User Messaging Platform).
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.
The functionality that allows users in the EEA to choose consent is handled by AdMob UMP (User Messaging Platform).
In
ADXConfiguration
, set GdprType toPOPUP_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.
(Note) When using POPUP_LOCATION
or POPUP_DEBUG
for initialization
, you must provide an Activity
as the Context
. Otherwise, initialization will not complete properly.
// 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
}
});

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
toDIRECT_NOT_REQUIRED
inADXConfiguration
.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);
4. Redisplay the GDPR consent screen
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) {
}
});
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?