CONSENT MANAGEMENT SDK INTEGRATION


In this detailed guide, we take you through the steps required to integrate the library with your Android and iOS app.

GETTING THE INTEGRATION KEY
 
STEP 1 - After a legal contract has been signed between the Publisher and Quadrant, an invitation will be sent to Publisher’s email redirecting them to register to the platform.
 
Screenshot 2020-12-23 at 20.40.04
 
STEP 2 - Register on the Quadrant Publisher Platform
 
2-Jul-01-2021-06-22-46-69-AM
 
STEP 3 - Once you're logged in, click PUBLISHER DASHBOARD from the menu on the left. This will display your publisher dashboard.
 
3-Jul-01-2021-06-25-30-83-AM
 
STEP 4 - Add your App, and choose 'Consent' as SDK type, select your desired OS Type, fill in all the required fields, and submit. What you fill in is what you will see in the consent form later in the app integrated with SDK.
 
c3
 
STEP 5 - Once submitted, your app will be enlisted, but the Integration key will not be displayed yet. At this point, you require an admin's approval. The admin will be automatically notified and can take the needful action.
 
5
 
STEP 6 - Once approved, your integration key will be displayed on the dashboard. You need to distribute this integration key to your app developers.
 
c4
 

INTEGRATING THE SDK - ANDROID

STEP 1 - In Android Studio, open build.gradle of the app (the project level), and add codes as highlighted in yellow:
c5
STEP 2 - Open build.gradle of the app (the app-specific level), and add this under the 'dependencies' code section (highlighted in yellow):
 
implementation 'io.quadrant.sdk.compliance:compliancesdk:<latest version>'

Latest version: 1.0.11

c6
STEP 3 - Still under build.gradle of the app, add this under 'defaultConfig' code section (highlighted in yellow):
 
multiDexEnabled true c7
STEP 4 - Sync the gradle files, now let’s try calling the setup method for initiating the consent Management SDK, fill in INTEGRATION_KEY with the that you fetched from the dashboard.
 
and that's it!
 
If you try accessing a method from the library in your code, it should work.
 
1. private Compliance compliance;
2. compliance Compliance.getInstance(INTEGRATION_KEY);
 
Congratulations! You have successfully integrated the library into your android project!
  
Displaying GDPR/ CCPA Form

This method will automatically detect which form to show depending on the app user’s position (if they are in Europe they will be shown the GDPR form, if they are in California, they will be shown the CCPA form, in all other cases no form will be displayed):

1 compliance.openConsentFormIfNeeded(this, getSupportFragmentManager());
 
And it is recommended that the form is called when the Location permission is granted because it will detect the users position as mentioned above.

Example:

1

2

3

if(PermissionUtil.accessLocation(this)){

compliance.openConsentFormIfNeeded(this, getSupportFragmentManager());

}

and the PermissionUtil class , example will look like similar to this (and for Kotlin it can be slightly adjusted):

public class PermissionUtil {
public static final int PERMISSION_ACCESS_LOCATION = 111;

public static boolean accessLocation(Context context){
boolean permission;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
if(ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
permission = false;
ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, PERMISSION_ACCESS_LOCATION);
}else{
permission = true;
}
}else{
permission = true;
}
return permission;
}
}

 

GDPR Form:

compliance.openConsentForm(getSupportFragmentManager(),Compliance.GDPR)

CCPA Form:

compliance.openConsentForm(getSupportFragmentManager(),Compliance.CCPA)

Sample GDPR Form:

GDPR sample screens

Fetching the TCFString (GDPR TCF String & CCPA US Privacy String) Function

After the user accept / consent, the TCF string is stored both in server and the app itself. So basically we can get the stored locally TCF String by calling the function:

1compliance.getTCFString(this); // For GDPR 2compliance.getUSPrivacyString(this);// For CCPA

with this is the Context of the Activity.

Calling Compliance Request Function

fill in REQUEST_TYPE with below options:

Compliance.REQUEST_OPTOUT

Compliance.REQUEST_DO_NOT_SELL

Compliance.REQUEST_DELETE_DATA → will display a delete request popup form

Compliance.REQUEST_ACCESS_DATA will display a request data popup form

compliance.initComplianceRequest(MainActivity.this, MainActivity.this.getSupportFragmentManager(), 
REQUEST_TYPE, new Compliance.ResultCallback(){
@Override
public void onSuccess(String result) {
//to do if request is successful
}

@Override
public void onError(String result) {
//to do if request is failed/error
}
});

Sample Compliance Request (Delete and Request Data form):

 

Sample Compliance Request (Delete and Request Data form)

 

INTEGRATING THE SDK - iOS

STEP 1 - Installation using Cocoapods

Add this line in your Podfile:

pod_link TBD

pod "QCMP_SDK", :git => 'pod_link'

and then install by type pod install in your command line

 

STEP 2 - Setup integration key

Register your integration key after app launch, usually your AppDelegate.swift

  • import QCMP_SDK to use this framework

  • Set up your integration key and error handle in didFinishLaunchingWithOptions 

    • import QCMP_SDK GIBB

      @UIApplicationMain
      class AppDelegate: UIResponder, UIApplicationDelegate {

      let compliance = Compliance.shared
      let integrationKey: String = "your integration key here"

      func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
      compliance.setup(integrationKey)
      }
      }
    • USING COMPLIANCE SDK

      • Register your integration key after app launch, usually your AppDelegate.swift

        • import QCMP_SDK to use this framework

        • You can use  openConsentForm(_ complianceType: ComplianceType) to open compliance form based on ComplianceType enum: GDPR or CCPA.

        • You also can use request compliance action by ComplianceRequest enum: REQUEST_OPTOUT, REQUEST_DO_NOT_SELL, REQUEST_DELETE_DATA or REQUEST_ACCESS_DATA

        you can see the example of code below:

    • import UIKit
      import QCMP_SDK

      class ViewControllerExample: UIViewController {

      let compliance = Compliance.shared

      @IBAction func openConsentGDPR() {
      compliance.openConsentForm(complianceType: .GDPR)
      }

      @IBAction func openConsentCCPA() {
      compliance.openConsentForm(complianceType: .CCPA)
      }

      @IBAction func requestOptOut() {
      compliance.initComplianceRequest(requestType: .REQUEST_OPTOUT) { [weak self] (result) in
      self?.handleResult(result, "Opt-out data")
      }
      }

      @IBAction func requestDoNotSell() {
      compliance.initComplianceRequest(requestType: .REQUEST_DO_NOT_SELL) { [weak self] (result) in
      self?.handleResult(result, "Do not sell data")
      }
      }

      @IBAction func requestdeleteData() {
      compliance.initComplianceRequest(requestType: .REQUEST_DELETE_DATA) { [weak self] result in
      self?.handleResult(result, "Delete data")
      }
      }

      @IBAction func requestAccessData() {
      compliance.initComplianceRequest(requestType: .REQUEST_ACCESS_DATA) { [weak self] result in
      self?.handleResult(result, "Access data")
      }
      }

      private func handleResult(_ result: Result<Bool, ComplianceError>, _ operartionName: String) {
      switch result {
      case .success(let isSucceeded):
      if isSucceeded {
      self.showAlert(nil, message: "\(operartionName) succeeded!")
      } else {
      self.showAlert("Error", message: "\(operartionName) failed!")
      }
      case .failure(let error):
      self.showAlert("Error", message: error.message)
      }
      }

      private func showAlert(_ title: String?, message: String) {
      let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
      let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
      alertController.addAction(okAction)
      self.present(alertController, animated: true, completion: nil)
      }
      }
       

Ready to add the Consent Management SDK into your app?
Speak to our data consultant to get started