Android CMP

Android CMP Integration Manual

1. Overview

SDK provides a Consent Collection feature or CMP. The SDK currently implements TCF v2. The TC string generated by the SDK is available to callers and can be found in the standard location as per TCF v2 specification.

2. Use Java 8 in your project

Put this setting into your gradle file

compileOptions { targetCompatibility = "8" }

3. Add SDK dependency to your project

Using Gradle:

Add our maven reference into your project setup (in buildscript and allprojects)

... buildscript { repositories { jcenter() google() maven { url 'https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/android' } } } ... ... allprojects { repositories { jcenter() google() maven { url 'https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/android' } } } ...

Use dependency to our libraries

implementation 'com.yieldlove.adIntegration:cmp:4.5.0'

4. Add third-party dependencies to your project

Add Google repository (in buildscript and allprojects)

5. Before you start

Receive an APPLICATION_NAME (to be set only once).

6. Set up application name

Before the beginning, you need to set up APPLICATION_NAME property. This needs to be done only once.

Simple Consent Message displays a view that contains legal information about how user’s data are collected and handled and usually two buttons, “Accept All” and “Manage My Options” (exact wording may vary and may appear translated).

To collect consent using a Simple Consent Message from users of your app, first initialize YieldloveConsent class, then call collect() API method:

NOTE: this is Activity context. R.id.main is ID of your main activity layout. Simple Consent Message will not show if consent has already been provided by the user in the past. Calling this method again after consent was provided will NOT show the Simple Consent Message. This is a feature. It allows app developer to call the method on application start without checking if consent has been provided before.

Note: Message language is optional parameter

7.2. Privacy Manager

Privacy Manager displays a more detailed view, where user can consent to individual purposes of their data collection and handling, and choose to share their data with specific vendors. It is the same view that is also accessible using “Manage My Options” button in the Simple Consent Message view.

To display Privacy Manager, first initialize YieldloveConsent class, then call showPrivacyManager() API method:

If it is set (on your consent account), You can also choose the privacy manager layout by calling showPrivacyManager("Your-Privacy-Manager-Layout-Name"), see below:

Note: Message language is optional parameter in both methods.

Use YieldloveConsentListener to react to consent events. You may need to manually show consent view and remove it after user action (see example below).

These events are supported:

  • OnConsentUIReady (called when the message is ready to be displayed. Here you must render the consent view.)

  • OnConsentUIFinished (called when the message is ready to disappear. Here you must hide the consent view.)

  • OnConsentReady (called when the user finishes interacting with the consent view)

  • OnError (called when something wrong happens in the consent view)

7.4. Programmatically consenting current user

It’s possible to programmatically consent the current user to a list of vendors, categories and legitimate interest categories by using the following method from the consentlib:

or

If you want to use Authenticated Consent feature, use constructor of YieldloveConsent with authId property

To see PUR (or different) CMP layer (layout), you can call function collect or showPrivacyManager with layoutName parameter. To know which layoutName you can use as parameter, ask publisher account management for the value of this property, the same person who gave you APPLICATION_NAME.

Change log

[4.5.2] (3.4.2023)

  • fix a bug where ProGuard rules would not be applied

[4.5.1] (29.3.2023)

  • fix a bug in CMP which prevented consent dialogue from being shown

[4.5.0] (21.3.2023)

  • maintenance release: upgrade SourcePoint client to 7.1.0

[4.4.0] (26.10.2022)

  • add layoutName option on collect method

[4.3.0] (30.9.2022)

  • add customConsentTo method with CustomConsentListener listener param

[4.2.0] (12.8.2022)

  • upgrade sourcepoint SDK version

[4.1.1] (7.7.2022)

  • fix minimal sdk version

[4.1.0] (14.3.2022)

  • support language settings

[4.0.0] (1.2.2022)

  • onAction callback method is now supported

[3.0.2] (6.12.2021)

  • upgrade to Sourcepoint lib 6.3.2

[3.0.1] (30.11.2021)

  • frozen Sourcepoint lib to version 6.3.0,

  • v6.3.1 is not compatible with our current implementation

[3.0.0] (24.11.2021)

Updated com.sourcepoint.cmplibrary:cmplibrary to version 6.3

API breaking changes:

  • In the YieldloveConsentListener interface the following methods have been updated:

    • void OnConsentReady(GDPRUserConsent c) changed to void OnConsentReady(SPConsents c)

    • void OnError(ConsentLibException v) changed to void OnError(Throwable v)

New Feature:

  • Support for multi campaigns

[2.4.0] (25.10.2021)

  • changes to fix dependencies problem

[2.3.0] (8.10.2021)

  • add option to choose privacy manager layout

[2.2.0] (23.9.2021)

  • support for authId added

[2.1.0]

  • dependencies don’t have fix versions

[2.0.2]

! fix reference problem

[2.0.1]

  • clear method can be called anytime

[2.0.0]

  • YL SDK v5 compatibility upgrade

[1.2.0]

  • version fix, can use newest version of SDK

[1.1.0]

[1.0.5]

  • extracted from Yieldlove SDK