diff --git a/build.gradle b/build.gradle index 7140c6b..57c5676 100644 --- a/build.gradle +++ b/build.gradle @@ -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' +} diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..167572c --- /dev/null +++ b/example/.gitignore @@ -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/ \ No newline at end of file diff --git a/example/build.gradle b/example/build.gradle new file mode 100644 index 0000000..0570d8f --- /dev/null +++ b/example/build.gradle @@ -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") + } + } + } +} \ No newline at end of file diff --git a/example/proguard-rules.pro b/example/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/example/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5754f10 --- /dev/null +++ b/example/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/src/main/java/com/mparticle/rokt/example/MainActivity.kt b/example/src/main/java/com/mparticle/rokt/example/MainActivity.kt new file mode 100644 index 0000000..fcf7326 --- /dev/null +++ b/example/src/main/java/com/mparticle/rokt/example/MainActivity.kt @@ -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