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().
Call setCoppaCompliantEnabled before you initialize the SDK. See Configuration for how to create the config.
Method signature
public void setCoppaCompliantEnabled(boolean coppaCompliantEnabled)
| Parameter | Type | Description |
|---|---|---|
coppaCompliantEnabled | boolean | Pass true to enable COPPA compliance. Pass false to disable it. |
What this method does
When you enable COPPA compliance, the SDK:
- Disables third-party sharing before the user launches their first session.
- Prevents the SDK from reading device and advertising IDs (for example
gps_adidandandroid_id).
Enable COPPA compliance
- Java
- Kotlin
- Javascript
String appToken = "{YourAppToken}";
String environment = AdTraceConfig.ENVIRONMENT_SANDBOX;
AdTraceConfig config = new AdTraceConfig(this, appToken, environment);
config.setCoppaCompliantEnabled(true);
AdTrace.onCreate(config);
val appToken = "{YourAppToken}"
val environment = AdTraceConfig.ENVIRONMENT_SANDBOX
val config = AdTraceConfig(this, appToken, environment)
config.setCoppaCompliantEnabled(true)
AdTrace.onCreate(config)
let appToken = "{YourAppToken}";
let environment = AdTraceConfig.EnvironmentSandbox;
let config = new AdTraceConfig(appToken, environment);
config.setCoppaCompliantEnabled(true);
AdTrace.onCreate(config);
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:
- Java
- Kotlin
- Javascript
config.setCoppaCompliantEnabled(false);
config.setCoppaCompliantEnabled(false)
config.setCoppaCompliantEnabled(false);
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 compliance | Play Store Kids app | |
|---|---|---|
| Use when | Your app must comply with COPPA (USA children's privacy law) | Your app targets users under 13 outside the USA install region |
| Method | setCoppaCompliantEnabled(true) | setPlayStoreKidsAppEnabled(true) |
| Third-party sharing | Disabled before first session | Not the primary focus of this flag |
| Device / ad IDs | Not read | Not read |
You may need one or both depending on your app and audience. See Mark as Play Store Kids app.