---
schema_version: "1"
id: 888102a9bdba5475c339fa41608b6d0b3760c8a3c855923de870656ca2a7fde8
title: Consent Management (Version 2.x)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-engagement-mobile-sdk/guides/c360a-api-engagement-mobile-sdk-consent-management-v2.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-consent-management-v2.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0133a856af6e7bdc1c1a0e7879cc59614bee92e0dccd187b372cd291d94e7d77
products:
  - Data 360 Engagement Mobile SDK
  - Data 360 Developer Documentation
---
# Consent Management (Version 2.x)

The Engagement Mobile SDK provides a comprehensive, managed solution for handling user consent regarding the collection and transmission of event data. This feature is essential for compliance with privacy regulations such as GDPR, CCPA, and other regional privacy laws that require explicit user consent before collecting personal data.

Your mobile application is responsible for:

- **Presenting clear consent options** to device owners about data collection practices
- **Collecting user preferences** through appropriate UI components (consent dialogs, settings screens, etc.)
- **Setting the Data 360 Module consent property** based on user choice
- **Handling consent changes** when users modify their preferences
- **Storing consent state** persistently across app sessions

The SDK automatically manages data collection behavior based on the consent state you set, ensuring compliance and providing a seamless user experience.

## Consent States

This table describes the Data 360 Module consent states.

| iOS Values        | Android Values    | Description                                                                                                                                                                                                            |
| ----------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Consent.optIn`   | `Consent.OPT_IN`  | In this state, events are transmitted to the configured Data 360 endpoint for collection. If queued events are present, the Data 360 Module transmits them immediately to Data 360.                                    |
| `Consent.optOut`  | `Consent.OPT_OUT` | In this state, events created by the mobile application are ignored by the SDK. The events are never queued or transmitted off the device. If queued events are present, the Data 360 Module deletes them from memory. |
| `Consent.pending` | `Consent.PENDING` | The default consent value for a newly initialized Data 360 Module is pending. In this state, events are collected locally until an opt-in or opt-out state is set.                                                     |

## Grant or Revoke Consent

The Data 360 Module can't transmit events from a mobile device to Data 360 until the mobile application has collected customer consent for data collection.

If no prior consent has been set, then the initial state is pending. In this state, events are queued locally until consent is granted or revoked. If consent is granted, the queued events are transmitted to Data 360. If revoked, they're deleted from the queue.

```
import Cdp

// when a user consents to data collection
CdpModule.shared.setConsent(consent: Consent.optIn)

// when a user does not consent to data collection
CdpModule.shared.setConsent(consent: Consent.optOut)
```

```
import com.salesforce.marketingcloud.cdp.CdpSdk
import com.salesforce.marketingcloud.cdp.consent.Consent

// when a user consents to data collection
CdpSdk.requestSdk { sdk -> sdk.consent = Consent.OPT_IN }

// when a user does not consent to data collection
CdpSdk.requestSdk { sdk -> sdk.consent = Consent.OPT_OUT }
```

## Read Consent State

Access the current state of consent in the Data 360 Module:

```
let consent = CdpModule.shared.getConsent()
```

```
CdpSdk.requestSdk { sdk ->
  val consent = sdk.consent
}
```
