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 )
}
}
Consent Status
The consent manager returns one of the following statuses:
Status Description UNKNOWNConsent status not yet determined REQUIREDConsent required (popup will be shown) NOT_REQUIREDConsent not required (non-GDPR region) OBTAINEDConsent 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
Geography Description 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.
Complete Example
import React , { useEffect , useState } from 'react'
import { View , Text , Button } from 'react-native'
import {
Adrop ,
AdropConsent ,
AdropConsentDebugGeography ,
} from 'adrop-ads-react-native'
const App = () => {
const [ consentStatus , setConsentStatus ] = useState < string >( 'unknown' )
useEffect (() => {
initializeConsent ()
}, [])
const initializeConsent = async () => {
// Initialize Adrop first
await 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 ?? 'unknown' )
}
}
const resetConsent = async () => {
await AdropConsent . reset ()
await initializeConsent ()
}
return (
< View style = {{ flex : 1 , justifyContent : 'center' , alignItems : 'center' }} >
< Text > Consent Status : { 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.