Commit f99b566
authored
feat: [SDK-2197] Add
## Summary
Adds a `LDReplay. registerActivity()` method that allows registering an
activity after it has already been created. Normally, Android Session
Replay uses Activity lifecycle hooks to listen for when Activities get
created and register them. But React Native Session Replay gets
initialized after the main Activity has already been created. So this
method can be used to hook it up manually.
## How did you test this change?
I manually tested this by publishing to a local maven repo and using it
with the example app and a modified session replay SDK.
## Are there any deployment considerations?
N/A
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk additive change that exposes a new optional API for wiring
touch capture when initialization happens after an `Activity` has
started; primary risk is incorrect registration leading to missed or
duplicate touch interception in edge cases.
>
> **Overview**
> Adds a new opt-in `LDReplay.registerActivity(Activity)` API to support
frameworks (e.g. React Native) that initialize Session Replay after the
host `Activity` is already running.
>
> This threads a new `registerActivity` call through `LDReplay` →
`SessionReplayService` → `InteractionSource`, where
`InteractionSource.registerActivity` simulates the
`onActivityStarted`/`onActivityResumed` lifecycle events to install the
touch interceptor and set the active window.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
fe49982. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- ld-jira-link -->
---
Related Jira issue: [SDK-2197: Fix Android RN Session Replay not
attaching to
MainActivity](https://launchdarkly.atlassian.net/browse/SDK-2197)
<!-- end-ld-jira-link -->LDReplay. registerActivity() method for React Native. (#472)1 parent a0f5cf8 commit f99b566
4 files changed
Lines changed: 49 additions & 0 deletions
File tree
- sdk/@launchdarkly/observability-android/lib/src
- main/kotlin/com/launchdarkly/observability
- replay
- sdk
- test/kotlin/com/launchdarkly/observability/sdk
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
156 | 166 | | |
157 | 167 | | |
158 | 168 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
236 | 245 | | |
237 | 246 | | |
238 | 247 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| 75 | + | |
63 | 76 | | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
57 | 74 | | |
0 commit comments