diff --git a/core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts b/core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts index 6ea0fac8..c6ce5f66 100644 --- a/core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts +++ b/core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts @@ -66,7 +66,8 @@ dependencies { implementation("androidx.navigation:navigation-fragment-ktx:2.5.3") implementation("androidx.navigation:navigation-ui-ktx:2.5.3") implementation("com.google.android.material:material:1.7.0") - implementation("com.mparticle:android-core:5.48.0") + implementation("com.mparticle:android-core:5+") + implementation("com.mparticle:android-kit-base:5+") implementation("com.google.android.gms:play-services-ads-identifier:18.0.1") // implementation(platform("com.google.firebase:firebase-bom:31.0.2")) diff --git a/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/HiggsShopSampleApplication.kt b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/HiggsShopSampleApplication.kt index 59cb9c34..0a9e271d 100644 --- a/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/HiggsShopSampleApplication.kt +++ b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/HiggsShopSampleApplication.kt @@ -3,15 +3,23 @@ package com.mparticle.example.higgsshopsampleapp; import android.app.Application import com.mparticle.MParticle import com.mparticle.MParticleOptions -import com.mparticle.networking.NetworkOptions +import com.mparticle.example.higgsshopsampleapp.sideloading_kits.LoggingCustomKit +import com.mparticle.example.higgsshopsampleapp.sideloading_kits.MinimalSideloadingKit -class HiggsShopSampleApplication: Application() { +class HiggsShopSampleApplication : Application() { val TAG = "HiggsShopSampleApplication" override fun onCreate() { super.onCreate() val options: MParticleOptions = MParticleOptions.builder(this) - .credentials(BuildConfig.HIGGS_SHOP_SAMPLE_APP_KEY, BuildConfig.HIGGS_SHOP_SAMPLE_APP_SECRET) + .credentials( + BuildConfig.HIGGS_SHOP_SAMPLE_APP_KEY, + BuildConfig.HIGGS_SHOP_SAMPLE_APP_SECRET + ) .environment(MParticle.Environment.Development) + .sideloadedKits(listOf( + LoggingCustomKit(1000001), LoggingCustomKit(1000002), + MinimalSideloadingKit(5000000) + )) // Disable SSL pinning for debugging network requests // .networkOptions( // NetworkOptions.builder() diff --git a/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/LoggingCustomKit.kt b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/LoggingCustomKit.kt new file mode 100644 index 00000000..75f02b94 --- /dev/null +++ b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/LoggingCustomKit.kt @@ -0,0 +1,88 @@ +package com.mparticle.example.higgsshopsampleapp.sideloading_kits + +import android.content.Context +import android.util.Log +import com.mparticle.MPEvent +import com.mparticle.internal.CoreCallbacks.KitListener +import com.mparticle.kits.KitIntegration.EventListener +import com.mparticle.kits.MPSideloadedKit +import com.mparticle.kits.ReportingMessage +import java.lang.Exception + +class LoggingCustomKit(kitId: Int) : MPSideloadedKit(kitId), KitListener, EventListener { + + companion object { + private const val CUSTOM_KIT = "LoggingCustomKit" + } + + override fun getName(): String = CUSTOM_KIT + + override fun onKitCreate( + settings: MutableMap?, + context: Context? + ): MutableList { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT onKitCreate") + return mutableListOf() + } + + override fun leaveBreadcrumb(breadcrumb: String?): MutableList { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT leaveBreadcrumb with breadcrumb: ${breadcrumb.orEmpty()}") + return mutableListOf() + } + + override fun logError( + message: String?, + errorAttributes: MutableMap? + ): MutableList { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT logError with message: ${message.orEmpty()}") + return mutableListOf() + } + + override fun logException( + exception: Exception?, + exceptionAttributes: MutableMap?, + message: String? + ): MutableList { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT logException with exception: ${exception?.message.orEmpty()} and message: ${message.orEmpty()}") + return mutableListOf() + } + + override fun logEvent(baseEvent: MPEvent): MutableList? { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT logEvent with name: ${baseEvent.eventName}") + return super.logEvent(baseEvent) + } + + override fun logScreen( + screenName: String?, + screenAttributes: MutableMap? + ): MutableList { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT logScreen with screen name: ${screenName.orEmpty()}") + return mutableListOf() + } + + override fun setOptOut(optedOut: Boolean): MutableList = mutableListOf() + + override fun kitFound(kitId: Int) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT kitFound for kit: $kitId") + } + + override fun kitConfigReceived(kitId: Int, p1: String?) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT kitConfigReceived for kit: $kitId") + } + + override fun kitExcluded(kitId: Int, p1: String?) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT kitExcluded for kit $kitId") + } + + override fun kitStarted(kitId: Int) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT kitStarted for kit: $kitId") + } + + override fun onKitApiCalled(kitId: Int, p1: Boolean?, vararg p2: Any?) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT onKitApiCalled for kit: $kitId") + } + + override fun onKitApiCalled(methodName: String?, kitId: Int, p2: Boolean?, vararg p3: Any?) { + Log.d(CUSTOM_KIT, "$CUSTOM_KIT onKitApiCalled for kit: $kitId with method name: ${methodName.orEmpty()}") + } +} \ No newline at end of file diff --git a/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/MinimalSideloadingKit.kt b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/MinimalSideloadingKit.kt new file mode 100644 index 00000000..67ecda96 --- /dev/null +++ b/core-sdk-samples/higgs-shop-sample-app/app/src/main/kotlin/com/mparticle/example/higgsshopsampleapp/sideloading_kits/MinimalSideloadingKit.kt @@ -0,0 +1,5 @@ +package com.mparticle.example.higgsshopsampleapp.sideloading_kits + +import com.mparticle.kits.MPSideloadedKit + +class MinimalSideloadingKit(kitId : Int) : MPSideloadedKit(kitId) \ No newline at end of file