-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added new way for tracking life cycle events in android using l…
…ife cycle observer (#225) * fix: using AtomicIntegers in Application life cycle manager * feat: added support for new way of tracking life cycle events and deep links * chore: minor refactors based on review comments * chore: upgraded kotlin and gradle versions in all modules * chore: reading writekey and dataplane url from local.properties * feat: made dependencies for tracking new life cycle events compile only and needed to be added by customer based on requirement * chore: minor changes * fix: code structure (#233) * fix: setting isFirstLaunch to false on firstLaunch even when user opted out * chore: using a primitive boolean expression * fix: fixed merge issue in sample-kotlin gradle file * chore: bumped the version of androix.core:core-ktx to 1.10.1 --------- Co-authored-by: Desu Sai Venkat <venkat@rudderstack.com> Co-authored-by: Debanjan Chatterjee <debanjanchatterjee99@gmail.com>
- Loading branch information
1 parent
a0212f0
commit ae5a938
Showing
16 changed files
with
455 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/src/main/java/com/rudderstack/android/sdk/core/AndroidXLifeCycleManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.rudderstack.android.sdk.core; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.lifecycle.DefaultLifecycleObserver; | ||
import androidx.lifecycle.LifecycleOwner; | ||
|
||
public class AndroidXLifeCycleManager implements DefaultLifecycleObserver { | ||
private ApplicationLifeCycleManager applicationLifeCycleManager; | ||
private RudderUserSessionManager userSessionManager; | ||
|
||
public AndroidXLifeCycleManager(ApplicationLifeCycleManager applicationLifeCycleManager, RudderUserSessionManager userSessionManager) { | ||
this.applicationLifeCycleManager = applicationLifeCycleManager; | ||
this.userSessionManager = userSessionManager; | ||
} | ||
|
||
@Override | ||
public void onStart(@NonNull LifecycleOwner owner) { | ||
userSessionManager.startSessionTrackingIfApplicable(); | ||
applicationLifeCycleManager.sendApplicationOpened(); | ||
} | ||
|
||
@Override | ||
public void onStop(@NonNull LifecycleOwner owner) { | ||
applicationLifeCycleManager.sendApplicationBackgrounded(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.