Skip to main content

Enable COPPA compliance

If your app must comply with the Children's Online Privacy Protection Act (COPPA), call setCoppaCompliantEnabled on your AdTraceConfig instance before AdTrace.onCreate().

Important

Call setCoppaCompliantEnabled before you initialize the SDK. See Configuration for how to create the config.

Method signature

public void setCoppaCompliantEnabled(boolean coppaCompliantEnabled)
ParameterTypeDescription
coppaCompliantEnabledbooleanPass true to enable COPPA compliance. Pass false to disable it.

What this method does

When you enable COPPA compliance, the SDK:

  1. Disables third-party sharing before the user launches their first session.
  2. Prevents the SDK from reading device and advertising IDs (for example gps_adid and android_id).

Enable COPPA compliance

String appToken = "{YourAppToken}";
String environment = AdTraceConfig.ENVIRONMENT_SANDBOX;
AdTraceConfig config = new AdTraceConfig(this, appToken, environment);
config.setCoppaCompliantEnabled(true);
AdTrace.onCreate(config);
Android 12+ and AD_ID

If your app targets Android 12 (API level 31) or higher and must not read the advertising ID, also remove the AD_ID permission from your manifest. See Google Advertising ID (AD_ID).

Disable COPPA compliance

Call the same method with false to turn COPPA compliance off:

config.setCoppaCompliantEnabled(false);
Third-party sharing after disable

Enabling COPPA compliance disables third-party sharing automatically. If you later disable COPPA compliance, third-party sharing is not turned back on automatically. Re-enable third-party sharing explicitly if you need that behavior again.

COPPA vs Play Store Kids

COPPA compliancePlay Store Kids app
Use whenYour app must comply with COPPA (USA children's privacy law)Your app targets users under 13 outside the USA install region
MethodsetCoppaCompliantEnabled(true)setPlayStoreKidsAppEnabled(true)
Third-party sharingDisabled before first sessionNot the primary focus of this flag
Device / ad IDsNot readNot read

You may need one or both depending on your app and audience. See Mark as Play Store Kids app.