How to integrate UniConsent CMP SDK for Android with mobile apps

UniConsent CMP is a package for handling GDPR IAB TCF 2.2 consent management in Android apps. You can find a demo app integrated with UniConsent CMP in the "uniconsent_demo" directory.


  • UniConsent CMP plan with Mobile app support
  • UniConsent CMP SDK package (request from support)

Getting started

To include the UniConsent package in your Flutter project, add it as a dependency in your pubspec.yaml file:

    path: ../uniconsent

Then, sync the dependency by running the following command:

flutter pub get


To use the UniConsent CMP in your app, follow these steps:

Initialize the CMP with an App ID from your account manager:

// Init CMP with appId

Display the CMP UI:

// Display CMP UI

Automatically check if consent is expired when the vendorList updates:

// Automatic check if consent is expired when vendorList updates
UniConsent.instance.shouldRequestConsent().then((shouldUpdate) => {
  if (shouldUpdate)
      // display CMP again

Get the tcString if required:

// Get tcString if requried
UniConsent.instance.getConsentInfo().then((info) => print(info?.tcString));

Read the consent status:

// Read consent status
    .then((info) => if(info?.purposeConsents.contains(DataUsagePurpose.useLimitedDataToSelectAds)) {
        // do something

Reset consent status if required:

// Reset consent status if required:


  1. Users should have the ability to access a "Privacy Settings" button or link in the settings section of your application in order to open the CMP UI.
  2. You can utilize the shouldRequestConsent() function to check whether you should request new consent based on the status. Display the CMP UI as needed when a user opens the application.