Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions .github/workflows/instrumented-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,17 @@ jobs:
java-version: "17"
- name: Gradle cache
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a #v2.9.0
- name: AVD cache
uses: actions/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b #v2.35.0
with:
api-level: 28
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
# AVD cache disabled: causes indefinite hangs on emulator shutdown (see
# ReactiveCircus/android-emulator-runner#373, #385, #362; WordPress/gutenberg#66771)
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: "Run Instrumented Tests (${{ inputs.display_name }})"
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b #v2.35.0
env:
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 60
with:
api-level: 28
force-avd-creation: false
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
[submodule "kits/foresee-kit"]
path = kits/foresee-kit
url = git@github.com:mparticle-integrations/mparticle-android-integration-foresee.git
[submodule "kits/onetrust-kit"]
path = kits/onetrust-kit
url = git@github.com:mparticle-integrations/mparticle-android-integration-onetrust.git
[submodule "kits/pilgrim-kit"]
path = kits/pilgrim-kit
url = git@github.com:mparticle-integrations/mparticle-android-integration-pilgrim.git
Expand Down
1 change: 1 addition & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ lint:
- kits/kochava/kochava-5/**
- kits/leanplum/leanplum-7/**
- kits/localytics/localytics-6/**
- kits/onetrust/onetrust/**
- kits/optimizely/optimizely-3/**
- kits/radar/radar-3/**
- kits/rokt/rokt/**
Expand Down
1 change: 0 additions & 1 deletion kits/onetrust-kit
Submodule onetrust-kit deleted from e29e1c
33 changes: 33 additions & 0 deletions kits/onetrust/onetrust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## OneTrust Kit Integration

[See here for more information](https://github.com/mParticle/mparticle-android-sdk/wiki/Kit-Development) on how to use this example to write a new kit.

This repository contains the [OneTrust](https://www.onetrust.com) integration for the [mParticle Android SDK](https://github.com/mParticle/mparticle-android-sdk).

### Adding the integration

1. Add the kit dependency to your app's build.gradle:

```groovy
dependencies {
implementation 'com.mparticle:android-onetrust-kit:5+'
// Implement the SDK version that corresponds to the published version you're using'
implementation 'com.onetrust.cmp:native-sdk:X.X.0.0'

// Example:
implementation 'com.onetrust.cmp:native-sdk:202308.1.0.0'
}
}
```
_Note: OneTrust is unique in their versioning and in that you must specify your version used from a constrained list in their UI. This necessitates that we cannot pin the version of the OneTrust SDK in this kit. Therefore you must pin the correct version in the build.gradle file of your application. For more information on this checkout this [OneTrust Guide for Adding the SDK to an Android App](https://developer.onetrust.com/onetrust/docs/adding-sdk-to-app-android)_

2. Follow the mParticle Android SDK [quick-start](https://github.com/mParticle/mparticle-android-sdk), then rebuild and launch your app, and verify that you see `"<REPLACE ME> detected"` in the output of `adb logcat`.
3. Reference mParticle's integration docs below to enable the integration.

### Documentation

[OneTrust integration](https://docs.mparticle.com/integrations/onetrust/event/)

### License

[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
65 changes: 65 additions & 0 deletions kits/onetrust/onetrust/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
buildscript {
ext.kotlin_version = '2.0.20'
if (!project.hasProperty('version') || project.version.equals('unspecified')) {
project.version = '+'
}

repositories {
google()
mavenLocal()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath 'com.mparticle:android-kit-plugin:' + project.version
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id "org.sonarqube" version "3.5.0.2730"
id "org.jlleitschuh.gradle.ktlint" version "13.0.0"
}

sonarqube {
properties {
property "sonar.projectKey", "mparticle-android-integration-onetrust"
property "sonar.organization", "mparticle"
property "sonar.host.url", "https://sonarcloud.io"
}
}

apply plugin: 'org.jlleitschuh.gradle.ktlint'
apply plugin: 'kotlin-android'
apply plugin: 'com.mparticle.kit'

android {
namespace 'com.mparticle.kits.onetrust'
buildFeatures {
buildConfig = true
}
defaultConfig {
minSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
testOptions {
unitTests.all {
jvmArgs += ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']
}
}
}

dependencies {
testImplementation fileTree(dir: 'libs', include: ['*.jar'])
//note that compileOnly requires kit users to define the dependency themselves
compileOnly 'com.onetrust.cmp:native-sdk:202411.2.0.0'
// Add as testImplementation so tests can load OneTrustKit class
testImplementation 'com.onetrust.cmp:native-sdk:202411.2.0.0'
}
1 change: 1 addition & 0 deletions kits/onetrust/onetrust/consumer-proguard.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: Add rules to exclude your SDK classes from proguard in implementing apps
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions kits/onetrust/onetrust/docs/manual-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# OneTrust Kit Manual Test Procedure
## Environments
### mParticle Environment
Has a number of purposes configured and, in the connection to the OneTrust output has them mapped to the different categories/purposes and vendors (of all types) in OneTrusts, that are listed in our UI as:

- Purpose Consent mapping
- IAB Vendor Consent Mapping
- Google Vendor Consent Mapping
- General (SDK) Vendor Consent Mapping

##### Sample Configuration
![image](assets/connection-settings.png)

### OneTrust Environment
Has a IAB TCF 2.2 template with a number of purposes and vendors assigned to the application.

Those would be mapped to the mParticle purposes as explained above.

### Testing Process
The kit should be manually tested by following this process:

1. Connect a test application to a testing environment that has been configured as per above in both mParticle and OneTrust.
1. Start the application.
1. Get the OneTrust banner or preference centre centre to show.
1. Accept all purposes and vendors.
1. Ensure a batch is sent from the application i.e. by triggering an event.
1. Verify:
- In the user profile at mParticle, that you can see via Activity > User Activity > [Search the profile] > Information tab, under "Consent and Compliance", all purposes should be consented (Look under "Consented" column, where all configured purposes should have `true`).
1. Get the OneTrust banner or preference centre centre to show.
1. Reject all purposes and vendors.
1. Ensure a batch is sent from the application i.e. by triggering an event.
1. Verify:
- In the user profile at mParticle, that you can see via Activity > User Activity > [Search the profile] > Information tab, under "Consent and Compliance", all purposes should be not consented (Look under "Consented" column, where all configured purposes should have `false`).
1. Get the OneTrust banner or preference centre centre to show.
1. Alternate accepting and rejecting purposes and vendors e.g. accept the first, reject the second, accept the third, reject the fourth, etc.
1. Ensure a batch is sent from the application i.e. by triggering an event.
1. Verify:
- In the user profile at mParticle, that you can see via Activity > User Activity > [Search the profile] > Information tab, under "Consent and Compliance", ensure that all purposes consent state match those set in OneTrust banner or preference centre.
1. Get the OneTrust banner or preference centre centre to show.
1. Toggle the consent state set previously i.e. reject where accepted and accept where rejected.
1. Ensure a batch is sent from the application i.e. by triggering an event.
1. Verify:
- In the user profile at mParticle, that you can see via Activity > User Activity > [Search the profile] > Information tab, under "Consent and Compliance", ensure that all purposes consent state match those set in OneTrust banner or preference centre.

The testing is successfull if the "Verify" steps are all positive.
4 changes: 4 additions & 0 deletions kits/onetrust/onetrust/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560m
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
160 changes: 160 additions & 0 deletions kits/onetrust/onetrust/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading