@@ -30,6 +30,7 @@ import com.clevertap.android.sdk.CleverTapAPI
3030import com.clevertap.android.sdk.CleverTapInstanceConfig
3131import com.clevertap.android.sdk.pushnotification.PushConstants
3232import com.clevertap.android.sdk.pushnotification.PushNotificationHandler
33+ import com.leanplum.LeanplumActivityHelper
3334import com.leanplum.callbacks.CleverTapInstanceCallback
3435import com.leanplum.internal.Constants
3536import 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 }
0 commit comments