From 84b88a06f8896b4ddc9d9a9363bc3ea5478be4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Wed, 22 Jan 2025 12:31:42 +0100 Subject: [PATCH 1/2] Do not autotrack screen view events when app comes to foreground (close #701) --- .../core/tracker/ActivityLifecycleHandler.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ActivityLifecycleHandler.kt b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ActivityLifecycleHandler.kt index c95bcac4b..5aba837e1 100644 --- a/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ActivityLifecycleHandler.kt +++ b/snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ActivityLifecycleHandler.kt @@ -24,6 +24,7 @@ import com.snowplowanalytics.snowplow.event.ScreenView.Companion.buildWithActivi @RestrictTo(RestrictTo.Scope.LIBRARY) class ActivityLifecycleHandler private constructor(context: Context) : Application.ActivityLifecycleCallbacks { + private var lastActivityHashCode: Int? = null init { val application = context.applicationContext as? Application @@ -31,6 +32,10 @@ class ActivityLifecycleHandler private constructor(context: Context) : } override fun onActivityResumed(activity: Activity) { + val sameActivity = lastActivityHashCode?.let { it == activity.hashCode() } ?: false + if (sameActivity) { return } + lastActivityHashCode = activity.hashCode() + Logger.d(TAG, "Auto screenview occurred - activity has resumed") try { val event = buildWithActivity(activity) From 2229c8b25e573e4646423d7fa15be2ee7daeb25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matu=CC=81s=CC=8C=20Tomlein?= Date: Wed, 22 Jan 2025 12:48:21 +0100 Subject: [PATCH 2/2] Prepare for 6.1.1 release --- CHANGELOG | 4 ++++ VERSION | 2 +- build.gradle | 2 +- gradle.properties | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e3300fd05..860b38fb2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +Version 6.1.1 (2025-01-22) +-------------------------- +Do not autotrack screen view events when app comes to foreground (#701) + Version 6.1.0 (2025-01-16) -------------------------- Add new WebView interface (#700) diff --git a/VERSION b/VERSION index dfda3e0b4..f3b5af39e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.0 +6.1.1 diff --git a/build.gradle b/build.gradle index d10c11b11..31d7e5015 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ plugins { subprojects { group = 'com.snowplowanalytics' - version = '6.1.0' + version = '6.1.1' repositories { google() maven { diff --git a/gradle.properties b/gradle.properties index 6bedc6c4b..5b84610c6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -31,7 +31,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000 SONATYPE_STAGING_PROFILE=comsnowplowanalytics GROUP=com.snowplowanalytics POM_ARTIFACT_ID=snowplow-android-tracker -VERSION_NAME=6.1.0 +VERSION_NAME=6.1.1 POM_NAME=snowplow-android-tracker POM_PACKAGING=aar