Skip to content

Commit 504030e

Browse files
authored
Fix CT migration app launch (#568)
Fix clevertap livecycle initialization
1 parent b53dc9d commit 504030e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

AndroidSDKCore/src/main/java/com/leanplum/migration/wrapper/CTWrapper.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import com.clevertap.android.sdk.CleverTapAPI
3030
import com.clevertap.android.sdk.CleverTapInstanceConfig
3131
import com.clevertap.android.sdk.pushnotification.PushConstants
3232
import com.clevertap.android.sdk.pushnotification.PushNotificationHandler
33+
import com.leanplum.LeanplumActivityHelper
3334
import com.leanplum.callbacks.CleverTapInstanceCallback
3435
import com.leanplum.internal.Constants
3536
import com.leanplum.internal.Log
@@ -92,6 +93,12 @@ internal class CTWrapper(
9293
setLibrary("Leanplum")
9394
if (!ActivityLifecycleCallback.registered) {
9495
ActivityLifecycleCallback.register(context.applicationContext as? Application)
96+
if (!LeanplumActivityHelper.isActivityPaused() && !CleverTapAPI.isAppForeground()) {
97+
// Trigger onActivityResumed because onResume of ActivityLifecycle has already been executed
98+
// in this case. This could happen on first start with ct migration. This method will also
99+
// trigger App Launched if it was not send already.
100+
CleverTapAPI.onActivityResumed(LeanplumActivityHelper.getCurrentActivity())
101+
}
95102
}
96103
if (identityManager.isAnonymous()) {
97104
Log.d("Wrapper: identity not set for anonymous user")
@@ -103,8 +110,6 @@ internal class CTWrapper(
103110
Log.d("Wrapper: CleverTap instance created by Leanplum")
104111
}
105112
if (firstTimeStart) {
106-
// Track App Launched event, because onResume of activity has been executed before first run
107-
sendAppLaunchedEvent()
108113
// Send tokens in same session, because often a restart is needed for CT SDK to get them
109114
sendPushTokens(context)
110115
}

sdk-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.5.0-beta5
1+
7.5.0-beta6

0 commit comments

Comments
 (0)