> ## 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 in React Native

## 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` native module. Make sure you have completed the [Getting Started](/sdk/react-native/overview) installation guide first.
</Note>

***

## Basic Usage

Use the AdropConsent module to request user consent after initializing Adrop.

```typescript theme={null}
import { AdropConsent } from 'adrop-ads-react-native'

// Call after Adrop.initialize()
const requestConsent = async () => {
  const result = await AdropConsent.requestConsentInfoUpdate()
  if (result.error) {
    console.error('Consent error:', result.error)
  }
}
```

***

## AdropConsentResult

`requestConsentInfoUpdate()` returns the following result type:

```typescript theme={null}
interface AdropConsentResult {
  status: AdropConsentStatus
  canRequestAds: boolean
  canShowPersonalizedAds: boolean
  error?: string
}
```

| Field                    | Type                 | Description                           |
| ------------------------ | -------------------- | ------------------------------------- |
| `status`                 | `AdropConsentStatus` | Current consent status                |
| `canRequestAds`          | `boolean`            | Whether ad requests are allowed       |
| `canShowPersonalizedAds` | `boolean`            | Whether personalized ads can be shown |
| `error`                  | `string`             | Error message (if any)                |

***

## AdropConsentStatus

```typescript theme={null}
enum AdropConsentStatus {
  UNKNOWN = 0,
  REQUIRED = 1,
  NOT_REQUIRED = 2,
  OBTAINED = 3,
}
```

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

***

## Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:

```typescript theme={null}
import {
  AdropConsent,
  AdropConsentDebugGeography,
} from 'adrop-ads-react-native'

// Set debug geography before requesting consent
// Device ID is automatically detected
AdropConsent.setDebugSettings(AdropConsentDebugGeography.EEA)  // Test GDPR

// Reset consent for testing
AdropConsent.reset()
```

### 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>

***

## Additional Methods

### getConsentStatus

```typescript theme={null}
static getConsentStatus(): Promise<AdropConsentStatus>
```

Returns the current consent status.

### canRequestAds

```typescript theme={null}
static canRequestAds(): Promise<boolean>
```

Returns whether ad requests are currently allowed.

***

## Complete Example

```typescript theme={null}
import React, { useEffect, useState } from 'react'
import { View, Text, Button } from 'react-native'
import {
  Adrop,
  AdropConsent,
  AdropConsentStatus,
  AdropConsentDebugGeography,
} from 'adrop-ads-react-native'

const App = () => {
  const [consentStatus, setConsentStatus] = useState<AdropConsentStatus>(
    AdropConsentStatus.UNKNOWN
  )

  useEffect(() => {
    initializeConsent()
  }, [])

  const initializeConsent = async () => {
    // Initialize Adrop first
    Adrop.initialize(false)

    // Set debug settings in development
    if (__DEV__) {
      AdropConsent.setDebugSettings(AdropConsentDebugGeography.EEA)
    }

    // Request consent info update
    const result = await AdropConsent.requestConsentInfoUpdate()
    if (result.error) {
      console.error('Consent error:', result.error)
    } else {
      setConsentStatus(result.status)
    }
  }

  const resetConsent = async () => {
    AdropConsent.reset()
    await initializeConsent()
  }

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Consent Status: {AdropConsentStatus[consentStatus]}</Text>
      {__DEV__ && (
        <Button title="Reset Consent" onPress={resetConsent} />
      )}
    </View>
  )
}

export default App
```

***

## 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/react-native/targeting">
    Set up user and context targeting
  </Card>

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

  <Card title="Reference" icon="book" href="/sdk/react-native/reference">
    Types, methods, and error codes
  </Card>
</CardGroup>
