Skip to main content

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).
UMP integration requires the adrop-ads-backfill native module. Make sure you have completed the Getting Started installation guide first.

Basic Usage

Use the AdropConsent module to request user consent after initializing Adrop.
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:
interface AdropConsentResult {
  status: AdropConsentStatus
  canRequestAds: boolean
  canShowPersonalizedAds: boolean
  error?: string
}
FieldTypeDescription
statusAdropConsentStatusCurrent consent status
canRequestAdsbooleanWhether ad requests are allowed
canShowPersonalizedAdsbooleanWhether personalized ads can be shown
errorstringError message (if any)

AdropConsentStatus

enum AdropConsentStatus {
  UNKNOWN = 0,
  REQUIRED = 1,
  NOT_REQUIRED = 2,
  OBTAINED = 3,
}
StatusValueDescription
UNKNOWN0Consent status not yet determined
REQUIRED1Consent required (popup will be shown)
NOT_REQUIRED2Consent not required (non-GDPR region)
OBTAINED3Consent already obtained

Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:
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

GeographyDescription
DISABLEDUse actual device location
EEATest GDPR (European Economic Area)
REGULATED_US_STATETest CCPA (California, etc.)
OTHERTest non-regulated regions
Debug settings should only be used during development. Remove or disable them before releasing to production.

Additional Methods

getConsentStatus

static getConsentStatus(): Promise<AdropConsentStatus>
Returns the current consent status.

canRequestAds

static canRequestAds(): Promise<boolean>
Returns whether ad requests are currently allowed.

Complete Example

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

Request Early

Request consent as early as possible in your app lifecycle, ideally right after SDK initialization.

Handle Errors

Always handle consent errors gracefully and provide fallback behavior.

Test All Scenarios

Use debug settings to test all consent scenarios (required, not required, obtained) before release.

Respect User Choice

Once consent is obtained or declined, respect the user’s choice and don’t repeatedly ask.

Targeting

Set up user and context targeting

Getting Started

SDK installation and setup guide

Reference

Types, methods, and error codes