# Consent Management in Mobile SDKs

<p>This guide covers the consent management feature available in the RudderStack <a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/kotlin-sdk/" >Android (Kotlin)</a> and <a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/swift-sdk/" >iOS (Swift)</a> SDKs.</p>
<p>Consent management lets your app tell RudderStack what the user agreed to. Once you supply the user&rsquo;s consent choices, the SDK does two things automatically for the rest of the session:</p>
<ul>
<li><strong>Stamps every event</strong> with the user&rsquo;s consent state, under <code>context.consentManagement</code>. Your events to the cloud mode destinations are then filtered server-side using that stamp.</li>
<li><strong>Blocks device mode destinations</strong> the user has not allowed. A denied destination is never initialized, and it receives no events.</li>
</ul>
<p>You keep ownership of the consent UI. The SDK never shows a banner, never stores a choice, and never asks the user anything — it only acts on the consent values you hand it.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">This feature supports the <strong>Custom</strong> consent provider only. Named consent managers such as <code>OneTrust</code>, <code>Ketch</code>, and <code>iubenda</code> are not supported by the mobile SDKs yet. If you use one of those platforms, you can still use this feature — read the user&rsquo;s choices from your CMP&rsquo;s own SDK and pass them to RudderStack as custom consent category IDs.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="consent-on-the-event">Consent on the event</h2><p>While consent management is active, every event carries the user&rsquo;s consent state in its context:</p>
<div class="rs-code">
  <div class="rs-code__head">json<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-json" data-lang="json">{
  &#34;context&#34;: {
    &#34;consentManagement&#34;: {
      &#34;provider&#34;: &#34;custom&#34;,
      &#34;allowedConsentIds&#34;: [&#34;marketing&#34;, &#34;analytics&#34;],
      &#34;deniedConsentIds&#34;: [&#34;advertising&#34;]
    }
  }
}</code></pre></div>
</div>
<p>Each event keeps the consent values that were in force <strong>when the event was created</strong>. If the user changes their consent while an event is still being processed, that event still reports what the user had agreed to at the time, so your record of consent stays accurate.</p>
<p>When consent management is not active, the <code>consentManagement</code> block is absent entirely.</p>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text"><code>context.consentManagement</code> is owned by the SDK while consent management is enabled. If your own code or a custom plugin writes to that key, the SDK overwrites it and logs a warning.</div>
  </div>
</blockquote>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="persistence-and-identity">Persistence and identity</h2><ul>
<li><strong>Consent is not persisted.</strong> The SDK holds the consent state in memory only, and it is gone when the app is killed. Your app or your CMP owns the durable copy — supply it again on every launch.</li>
<li><strong><code>reset()</code> does not clear consent.</strong> Resetting the user identity leaves the consent state untouched, because consent is a device-level choice rather than a property of the signed-in user.</li>
<li><strong>Kotlin SDK: Android only.</strong> Consent management is not available in the server-side (JVM) artifact.</li>
</ul>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="faq">FAQ</h2><!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="can-i-read-the-current-consent-state-from-the-sdk">Can I read the current consent state from the SDK?</h4><p>No. <code>setConsent</code> only sets the state — there is no getter. Keep your own copy of the user&rsquo;s choices in your app or your CMP, and treat that as the source of truth.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h4 id="how-do-i-see-what-consent-management-is-doing">How do I see what consent management is doing?</h4><p>Set the log level to <code>verbose</code> or <code>debug</code>. See <a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/mobile-sdk-apis/logging-apis/" >Logging APIs in Mobile SDKs</a>. The SDK logs each event it drops and which destination it dropped it for, and warns whenever a call you made had no effect.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="see-more">See more</h2><ul>
<li><a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/client-side-features/consent-management/setup/" >How to Enable Consent Management in Mobile SDKs</a></li>
<li><a href="https://www.rudderstack.com/docs/sources/event-streams/sdks/client-side-features/consent-management/migrate-from-legacy-sdks/" >How to Migrate Consent Filters from the Legacy SDKs</a></li>
<li><a href="https://www.rudderstack.com/docs/data-governance/consent-management/custom-consent-manager/" >Custom Consent Management</a></li>
<li><a href="https://www.rudderstack.com/docs/data-governance/consent-management/overview/" >Consent Management Overview</a></li>
</ul>

