• Platforms
  • Partners
  • Forums
  • 日本語
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub

Table of Contents

  • Class: ConsentManager
    • getPolicy()
    • getUserConsentCategories()
    • getUserConsentPreferences()
    • getUserConsentStatus()
    • resetUserConsentPreferences()
    • setPolicy()
    • setUserConsentCategories()
    • setUserConsentStatus()
    • setUserConsentStatusWithCategories()
ANDROID JAVA

ConsentManager

Reference guide for ConsentManager class and methods provided by Tealium for Android.

Class: ConsentManager

The following summarizes the commonly used methods of the ConsentManager class.

Method Description
getPolicy() Returns the current policy
getUserConsentCategories() Returns the current consent categories of the user
getUserConsentPreferences() Returns the UserConsentPreferences object
getUserConsentStatus() Returns the current consent status of the user
resetUserConsentPreferences() Resets user consent consent preferences
setPolicy() Overrides the default policy parameter (default: gdpr)
setUserConsentCategories() Sets the user’s consent status and categories
setUserConsentStatus() Sets the user’s consent status
setUserConsentStatusWithCategories() Sets the consent status and categories in a single call

getPolicy()

Returns the current policy.

final String currentPolicy = tealiumInstance.getConsentManager().getPolicy();
Returns Return Type
User’s current policy String

getUserConsentCategories()

Returns the current consent categories of the user.

final String[] userCategories = tealiumInstance.getConsentManager().getUserConsentCategories();
Returns Return Type
User’s current consent categories String[]

getUserConsentPreferences()

Returns the user’s consent preferences.

final UserConsentPreferences userPreferences = tealiumInstance.getConsentManager().getUserConsentPreferences();
Returns Return Type
User’s consent preferences UserConsentPreferences

getUserConsentStatus()

Returns the current consent status of the user.

final String userStatus = tealiumInstance.getConsentManager().getUserConsentStatus();
Returns Return Type
User’s current consent status String

resetUserConsentPreferences()

Clears stored consent preferences, resets user preferences to defaults, and sets consent status to UNKNOWN with no categories.

tealiumInstance.getConsentManager().resetUserConsentPreferences();

setPolicy()

Overrides the default policy parameter. Default is gdpr.

tealiumInstance.getConsentManager().setPolicy(policy);
Parameter Type Description Example
policy String Policy to set "custompolicy"

setUserConsentCategories()

Sets the user’s consent status and categories. Call this method from your consent management preferences screen in your app. This method automatically sets the user’s consent status to CONSENTED if any number of categories are set.

tealiumInstance.getConsentManager().setUserConsentCategories(categories);
Parameter Type Description Example
categories [String] Categories to set String[]

The following static constants are the complete list of supported consent categories:

AFFILIATES
ANALYTICS
BIG_DATA
CDP
COOKIEMATCH
CRM
DISPLAY_ADS
EMAIL
ENGAGEMENT
MOBILE
MONITORING
PERSONALIZATION
SEARCH
SOCIAL
MISC

setUserConsentStatus()

Sets the user’s consent status. Call this method from your consent management preferences screen in your app when the user opts in or opts out of tracking. If true, automatically enables all categories. If false, all categories automatically disabled.

If the user’s status is set to CONSENTED using this method, the Consent Manager automatically subscribes the user to ALL available consent categories (subset of categories not allowed).

tealiumInstance.getConsentManager().setUserConsentStatus(status);
Parameter Type Description Example
status String Status to set the user’s consent [ConsentManager.ConsentStatus.CONSENTED, ConsentManager.ConsentStatus.NOT_CONSENTED]

These static constants are the complete list of supported consent statuses.

CONSENTED
NOT_CONSENTED
UNKNOWN

UNKNOWN
The UNKNOWN status is the default setting for the Consent Manager. In this state, the Consent Manager queues events locally until an affirmative CONSENTED/NOT_CONSENTED status is provided.

tealiumInstance.getConsentManager().setUserConsentStatus(ConsentManager.ConsentStatus.UNKNOWN);

CONSENTED
The CONSENTED status is set when the user has consented to tracking. In this status, the Consent Manager dequeues any previously-queued track calls and allow all subsequent tracking calls to continue as normal.

tealiumInstance.getConsentManager().setUserConsentStatus(ConsentManager.ConsentStatus.CONSENTED);

NOT_CONSENTED
The NOT_CONSENTED status is set when the user has declined tracking. In this state, the Consent Manager purges any previously-queued track calls and drops all subsequent tracking calls from being further processed by the SDK.

tealiumInstance.getConsentManager().setUserConsentStatus(ConsentManager.ConsentStatus.NOT_CONSENTED);

setUserConsentStatusWithCategories()

Sets the consent status and categories in a single call.

tealiumInstance.getConsentManager().setUserConsentStatusWithCategories(status, categories);
Parameter Type Description Example
status String Status to set the user’s consent [ConsentManager.ConsentStatus.CONSENTED, ConsentManager.ConsentStatus.NOT_CONSENTED]
categories [String] Categories to set new String[]{ConsentManager.ConsentCategory.ANALYTICS, ConsentManager.ConsentCategory.BIG_DATA}

See setUserConsentStatus() and setUserConsentCategories() for a list of constant supported.

DataSources

 
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • AppsFlyer
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Ad Identifier Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • RemoteCommands Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Flutter
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • Lifecycle Module
      • Location Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Unity
    • Overview
    • Install
    • Track
    • API Reference
  • Xamarin
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
    • Data Layer
      • An Introduction to the Data Layer
      • How the Data Layer Works for Websites
      • Data Layer Best Practices
      • Definitions
        • Retail
        • Publisher
        • Hotel
        • Travel
        • Basic Video Tracking
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Overview
    • Install
    • Track
    • Data Layer
  • Angular
    • Overview
    • Install
    • Track
    • API Reference
  • Google Tag Manager
    • Overview
    • Install
    • Data Layer
  • JavaScript (Web)
    • Overview
    • Install
    • Track
    • Data Layer
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference

Was this article helpful?

This page was last updated: March 18, 2020       Thank you for your feedback!
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova
  • Flutter
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity
  • Xamarin
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby