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
4 changes: 1 addition & 3 deletions kits/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@
{
"name": "rokt",
"local_path": "kits/rokt/rokt",
"kit_project": ":kits:android-rokt:rokt",
"example_kotlin_project": ":kits:android-rokt:rokt:example-kotlin",
"skip_example_builds": true
"kit_project": ":kits:android-rokt:rokt"
},
{
"name": "singular-12",
Expand Down
73 changes: 73 additions & 0 deletions kits/rokt/rokt/example/example-kotlin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Rokt Kit Kotlin Example

Standalone sample app for exercising the Rokt Kit through the mParticle SDK
(identify, user attributes, overlay and embedded placements, event stream).

This module is built standalone (own Gradle wrapper and settings) because the
Rokt SDK requires a newer AGP than the shared multi-kit build. It depends on the
single `com.rokt:rokt-sdk-plus` umbrella, which transitively provides
`android-core`, `android-rokt-kit`, `com.rokt:roktsdk`, and
`com.rokt:payment-extension`.

## Setup

1. Set the mParticle credentials: either replace the `DEFAULT_API_KEY` /
`DEFAULT_API_SECRET` placeholders in `ExampleApplication.kt`, or enter them
in the input fields at the top of the app and tap "Apply credentials"
(switches the workspace at runtime via `MParticle.switchWorkspace`, no
restart needed).
2. Replace the placement identifier placeholders in `MainActivity.kt`
(`REPLACE_WITH_OVERLAY_VIEW_NAME`, `REPLACE_WITH_BOTTOM_SHEET_VIEW_NAME`,
`REPLACE_WITH_EMBEDDED_VIEW_NAME`) and, if needed, the embedded placeholder
name (`Location1`).
3. Build and install:

```bash
./gradlew installDebug
```

The Rokt account id and the Stripe publishable key are not configured in the
app: both arrive with the kit configuration for the selected workspace.

The `com.rokt:rokt-sdk-plus` umbrella is not published to Maven Central, so the
example is built against a locally published copy (see below). The published
`com.rokt:payment-extension` / `com.rokt:roktsdk` it pulls in transitively come
from Maven Central.

## Joint testing against local builds

The umbrella (and the mParticle core + Rokt kit it bundles) are published to
Maven Local, then the example resolves them at the local version (`0.0.0`):

```bash
# from the repository root
./gradlew publishMavenPublicationToMavenLocal
./gradlew -c settings-kits.gradle :kits:android-rokt:rokt:publishMavenPublicationToMavenLocal \
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
./gradlew -c settings-rokt-sdk-plus.gradle :rokt-sdk-plus:publishMavenPublicationToMavenLocal

# from this directory
./gradlew installDebug -PmparticleVersion=0.0.0
```

Maven Local is resolved first, so locally published `com.rokt` artifacts
(e.g. a locally built `roktsdk` or `roktux`) also take precedence over Maven
Central when present.

## What to verify

- Identify runs at startup (`ExampleApplication`) with a test email and
customer id; user attributes are set once the identity resolves.
- "Apply credentials" switches to another workspace at runtime and the kit
re-initializes with that workspace's Rokt account.
- "Show overlay placement" and "Show bottom sheet placement" trigger
`selectPlacements` for overlay-style layouts.
- "Show embedded placement" passes a `RoktEmbeddedView` placeholder; the
height callback is logged.
- Placement events are collected from the kit's event flow and logged with
the `RoktKitExample` tag.
- "Close placements" dismisses any active overlay placement.

Debug builds trust user-installed CA certificates
(`network_security_config.xml`), so HTTPS traffic can be inspected with tools
like Proxyman or Charles.
28 changes: 23 additions & 5 deletions kits/rokt/rokt/example/example-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.android.application' version '8.9.1'
id 'org.jetbrains.kotlin.android' version '2.1.20'
}

// Standalone build: the Rokt SDK requires a newer AGP than the shared
// multi-kit build, so this example resolves the published Rokt SDK+ umbrella
// (mavenLocal first) instead of the in-repo kit project.
def mparticleVersion = providers.gradleProperty('mparticleVersion').getOrElse('6.0.0-rc.1')

configurations.all {
resolutionStrategy {
// android-rokt-kit floats android-kit-base with a dynamic '+' version, which would
// otherwise pull a higher published core/kit-base from Maven Central instead of the
// locally published build. Pin the mParticle chain to the umbrella's version.
force "com.mparticle:android-core:${mparticleVersion}"
force "com.mparticle:android-kit-base:${mparticleVersion}"
}
}

android {
namespace 'com.mparticle.kits.rokt.example.kotlin'
compileSdk 35
compileSdk 36

defaultConfig {
applicationId 'com.mparticle.kits.rokt.example.kotlin'
minSdk 21
minSdk 23
targetSdk 35
versionCode 1
versionName '1.0'
Expand All @@ -32,7 +47,10 @@ android {
}

dependencies {
implementation project(':kits:rokt:rokt')
// Rokt SDK+ umbrella: transitively provides android-core, android-rokt-kit,
// com.rokt:roktsdk, and com.rokt:payment-extension.
implementation "com.rokt:rokt-sdk-plus:${mparticleVersion}"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'com.google.android.material:material:1.11.0'
}
2 changes: 2 additions & 0 deletions kits/rokt/rokt/example/example-kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2g
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.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
234 changes: 234 additions & 0 deletions kits/rokt/rokt/example/example-kotlin/gradlew

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

Loading
Loading