> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adrop.io/llms.txt
> Use this file to discover all available pages before exploring further.

# UMP Integration

> Integrate Google UMP for GDPR/CCPA compliance on Android

## Overview

The User Messaging Platform (UMP) SDK helps you manage user consent for personalized advertising in compliance with GDPR (General Data Protection Regulation) and CCPA (California Consumer Privacy Act).

<Note>
  UMP integration requires the `adrop-ads-backfill` module. Make sure you have completed the [Getting Started](/sdk/android/overview) installation guide first.
</Note>

***

## Basic Usage

Use the Consent Manager to request user consent after initializing Adrop.

<CodeGroup>
  ```kotlin Kotlin theme={null}
  import io.adrop.ads.Adrop
  import io.adrop.ads.consent.AdropConsentListener
  import io.adrop.ads.consent.AdropConsentResult

  class MainActivity : AppCompatActivity() {

      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)

          // Call after Adrop.initialize()
          Adrop.consentManager?.requestConsentInfoUpdate(this, object : AdropConsentListener {
              override fun onConsentInfoUpdated(result: AdropConsentResult) {
                  if (result.error != null) {
                      Log.e("Consent", "Error: ${result.error}")
                  }
              }
          })
      }
  }
  ```

  ```java Java theme={null}
  import io.adrop.ads.Adrop;
  import io.adrop.ads.consent.AdropConsentListener;
  import io.adrop.ads.consent.AdropConsentResult;

  public class MainActivity extends AppCompatActivity {

      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

          // Call after Adrop.initialize()
          if (Adrop.getConsentManager() != null) {
              Adrop.getConsentManager().requestConsentInfoUpdate(this, new AdropConsentListener() {
                  @Override
                  public void onConsentInfoUpdated(AdropConsentResult result) {
                      if (result.getError() != null) {
                          Log.e("Consent", "Error: " + result.getError());
                      }
                  }
              });
          }
      }
  }
  ```
</CodeGroup>

***

## Consent Status

The consent manager returns one of the following statuses:

| Status         | Description                            |
| -------------- | -------------------------------------- |
| `UNKNOWN`      | Consent status not yet determined      |
| `REQUIRED`     | Consent required (popup will be shown) |
| `NOT_REQUIRED` | Consent not required (non-GDPR region) |
| `OBTAINED`     | Consent already obtained               |

***

## Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:

<CodeGroup>
  ```kotlin Kotlin theme={null}
  import io.adrop.ads.consent.AdropConsentDebugGeography

  if (BuildConfig.DEBUG) {
      // Set debug geography before requesting consent
      Adrop.consentManager?.setDebugSettings(
          testDeviceHashedIds = listOf("YOUR_HASHED_DEVICE_ID"),  // Check Logcat
          geography = AdropConsentDebugGeography.EEA  // Test GDPR
      )

      // Reset consent for testing
      Adrop.consentManager?.reset(this)
  }
  ```

  ```java Java theme={null}
  import io.adrop.ads.consent.AdropConsentDebugGeography;

  if (BuildConfig.DEBUG) {
      // Set debug geography before requesting consent
      Adrop.getConsentManager().setDebugSettings(
          Arrays.asList("YOUR_HASHED_DEVICE_ID"),  // Check Logcat
          AdropConsentDebugGeography.EEA  // Test GDPR
      );

      // Reset consent for testing
      Adrop.getConsentManager().reset(this);
  }
  ```
</CodeGroup>

### Debug Geographies

| Geography            | Description                        |
| -------------------- | ---------------------------------- |
| `DISABLED`           | Use actual device location         |
| `EEA`                | Test GDPR (European Economic Area) |
| `REGULATED_US_STATE` | Test CCPA (California, etc.)       |
| `OTHER`              | Test non-regulated regions         |

<Warning>
  Debug settings should only be used during development. Remove or disable them before releasing to production.
</Warning>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Request Early" icon="clock">
    Request consent as early as possible in your app lifecycle, ideally right after SDK initialization.
  </Card>

  <Card title="Handle Errors" icon="triangle-exclamation">
    Always handle consent errors gracefully and provide fallback behavior.
  </Card>

  <Card title="Test All Scenarios" icon="vial">
    Use debug settings to test all consent scenarios (required, not required, obtained) before release.
  </Card>

  <Card title="Respect User Choice" icon="user-check">
    Once consent is obtained or declined, respect the user's choice and don't repeatedly ask.
  </Card>
</CardGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Targeting" icon="bullseye" href="/sdk/android/targeting">
    Set up user and context targeting
  </Card>

  <Card title="Getting Started" icon="rocket" href="/sdk/android/overview">
    SDK installation and setup guide
  </Card>

  <Card title="Reference" icon="book" href="/sdk/android/reference">
    Classes, listeners, and error codes
  </Card>
</CardGroup>
