Skip to content
Open
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
17 changes: 16 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,24 @@ repositories {

dependencies {
implementation 'androidx.annotation:annotation:1.5.0'
api 'com.rokt:roktsdk:4.8.1'
api 'com.rokt:roktsdk:4.9.0'

testImplementation files('libs/java-json.jar')
testImplementation 'com.squareup.assertj:assertj-android:1.2.0'
testImplementation ("io.mockk:mockk:1.13.4")
}

allprojects {
group = 'com.mparticle'
repositories {
mavenLocal()
google()
mavenCentral()
}

tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

apply plugin: 'org.jlleitschuh.gradle.ktlint'
}
33 changes: 33 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties


# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches
.idea/
56 changes: 56 additions & 0 deletions example/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.mparticle.rokt.example'
compileSdk 34

defaultConfig {
applicationId "com.mparticle.rokt.example"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.13.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation project(":")
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.activity:activity:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

configurations.all {
resolutionStrategy {
eachDependency {
if (requested.group == "androidx.lifecycle" && requested.name == "lifecycle-livedata-core") {
useVersion("2.5.1")
}
}
}
}
21 changes: 21 additions & 0 deletions example/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
24 changes: 24 additions & 0 deletions example/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:networkSecurityConfig="@xml/network_security_config"
android:name=".MainApplication"
android:supportsRtl="true"
android:theme="@style/Theme.Androidroktkit">
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.mparticle.rokt.example

import android.os.Bundle
import android.util.Log
import android.widget.Button
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import java.lang.ref.WeakReference

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)
val attributes = mapOf(
Pair("lastname", "Smith"),
Pair("mobile", "1112223333"),
Pair("country", "USA"),
Pair("noFunctional", "true"),
Pair("email", "testEmail_${System.currentTimeMillis()}@example.com"),
Pair("sandbox", "true")
)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
val roktKit = (this.application as MainApplication).kit
findViewById<Button>(R.id.executeButton).setOnClickListener {
Log.d("ExampleActivity", "Button clicked")
roktKit.execute(
"mauitest",
attributes,
Runnable { },
Runnable { },
Runnable { },
Runnable { },
mutableMapOf("Location1" to WeakReference(findViewById(R.id.roktEmbeddedView))),
null,
null
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mparticle.rokt.example

import android.app.Application
import com.mparticle.kits.RoktKit

class MainApplication : Application() {
val kit = RoktKit()
override fun onCreate() {
super.onCreate()
// Initialize any libraries or SDKs here
val settings = mapOf("accountId" to "2754655826098840951")
kit.onKitCreate(settings, this)
}
}
Loading