Skip to content

Commit

Permalink
Fix CT migration app launch (#568)
Browse files Browse the repository at this point in the history
Fix clevertap livecycle initialization
  • Loading branch information
vasct authored Aug 23, 2024
1 parent b53dc9d commit 504030e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.clevertap.android.sdk.CleverTapAPI
import com.clevertap.android.sdk.CleverTapInstanceConfig
import com.clevertap.android.sdk.pushnotification.PushConstants
import com.clevertap.android.sdk.pushnotification.PushNotificationHandler
import com.leanplum.LeanplumActivityHelper
import com.leanplum.callbacks.CleverTapInstanceCallback
import com.leanplum.internal.Constants
import com.leanplum.internal.Log
Expand Down Expand Up @@ -92,6 +93,12 @@ internal class CTWrapper(
setLibrary("Leanplum")
if (!ActivityLifecycleCallback.registered) {
ActivityLifecycleCallback.register(context.applicationContext as? Application)
if (!LeanplumActivityHelper.isActivityPaused() && !CleverTapAPI.isAppForeground()) {
// Trigger onActivityResumed because onResume of ActivityLifecycle has already been executed
// in this case. This could happen on first start with ct migration. This method will also
// trigger App Launched if it was not send already.
CleverTapAPI.onActivityResumed(LeanplumActivityHelper.getCurrentActivity())
}
}
if (identityManager.isAnonymous()) {
Log.d("Wrapper: identity not set for anonymous user")
Expand All @@ -103,8 +110,6 @@ internal class CTWrapper(
Log.d("Wrapper: CleverTap instance created by Leanplum")
}
if (firstTimeStart) {
// Track App Launched event, because onResume of activity has been executed before first run
sendAppLaunchedEvent()
// Send tokens in same session, because often a restart is needed for CT SDK to get them
sendPushTokens(context)
}
Expand Down
2 changes: 1 addition & 1 deletion sdk-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.5.0-beta5
7.5.0-beta6

0 comments on commit 504030e

Please sign in to comment.