Android Session Replay¶
Prerequisites¶
- Ensure you have set up and initialized the FTSdk RUM configuration and enabled View monitoring collection.
- Android Session Replay is currently an alpha feature and requires using
ft-sdk:1.7.0or higher. - It is recommended to use the versions displayed in the badges above. Additionally, you can find the available alpha versions using the commands below. The alpha version changelogs are located in ft-sdk, ft-ft-session-replay, and ft-session-replay-material.
#ft-sdk alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-sdk/maven-metadata.xml | grep alpha
#ft-session-replay alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-session-replay/maven-metadata.xml | grep alpha
#ft-session-replay-material alpha version
curl https://mvnrepo.jiagouyun.com/repository/maven-releases/com/cloudcare/ft/mobile/sdk/tracker/agent/ft-session-replay-material/maven-metadata.xml | grep alpha
Configuration¶
// Add SDK dependency
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:[latest_alpha_version]
// Need to enable session replay feature
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-session-replay:[latest_alpha_version]'
// Need to support material components for session replay
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-session-replay-material:[latest_alpha_version]'
Code Call¶
| Method Name | Type | Required | Meaning |
|---|---|---|---|
| setSampleRate | Float | No | Set the collection rate, value range [0,1], 0 means no collection, 1 means full collection, default value is 1. |
| setSessionReplayOnErrorSampleRate | Float | No | Set the error collection rate. When a session is not sampled by setSampleRate, if an error occurs during the session, data from the 1 minute before the error can be collected. Value range [0,1], 0 means no collection, 1 means full collection, default value is 0. Supported in ft-session-replay 0.1.2-alpha01 and above. |
| setPrivacy | SessionReplayPrivacy | No | SessionReplayPrivacy.ALLOW does not mask private data, SessionReplayPrivacy.MASK masks all data, including text, CheckBox, RadioButton, Switch; SessionReplayPrivacy.USER_INPUT (recommended) masks part of the user input data, including text in input boxes, CheckBox, RadioButton, Switch. Default is SessionReplayPrivacy.MASK. Deprecated soon, compatible for now, it is recommended to use setTouchPrivacy and setTextAndInputPrivacy for masking settings first |
| setTextAndInputPrivacy | TextAndInputPrivacy | No | TextAndInputPrivacy.MASK_SENSITIVE_INPUTS only masks sensitive information like passwords, TextAndInputPrivacy.MASK_ALL_INPUTS masks part of the user input data, including text in input boxes, CheckBox, RadioButton, Switch, TextAndInputPrivacy.MASK_ALL, masks all data, including text, CheckBox, RadioButton, Switch. Default TextAndInputPrivacy.MASK_ALL. Settings here override the configuration of setPrivacy. Supported in ft-session-replay 0.1.1-alpha01 and above. |
| setTouchPrivacy | TouchPrivacy | No | TouchPrivacy.SHOW does not mask touch data, TouchPrivacy.HIDE masks touch data. Settings here override the configuration of setPrivacy. Supported in ft-session-replay 0.1.1-alpha01 and above. |
| addExtensionSupport | ExtensionSupport | No | Add additional custom support. Using ft-session-replay-material allows the use of MaterialExtensionSupport to provide additional Material component collection support. |
Privacy Override¶
Supported in
ft-session-replay0.1.1-alpha01 and above.
The SDK supports not only configuring global masking levels through FTSessionReplayConfig but also overriding these settings at the view level.
View-level privacy override:
- Supports overriding text and input masking levels and touch masking levels.
- Supports setting specific views to be completely hidden.
Note:
- To ensure override settings are correctly identified, they should be applied as early as possible in the view lifecycle. This prevents cases where Session Replay processes the view before the applied override.
- Privacy overrides affect the view and its child views. This means that even if an override is applied to a view where it might not take immediate effect (e.g., applying an image override to a text input), the override will still apply to all child views.
- Privacy override priority: Child view > Parent view > Global settings
Text and Input Override¶
To override text and input privacy, use PrivacyOverrideExtensions.setSessionReplayTextAndInputPrivacy(View,TextAndInputPrivacy) on the view instance, setting it to a value from the TextAndInputPrivacy enum. To remove an existing override rule, simply set this property to null.
Touch Override¶
To override touch privacy, use PrivacyOverrideExtensions.setSessionReplayTouchPrivacy(View,TouchPrivacy) on the view instance, setting it to a value from the TouchPrivacy enum. To remove an existing override rule, simply set this property to null.
Hidden Element Override¶
For sensitive elements that need to be completely hidden, use PrivacyOverrideExtensions.setSessionReplayHidden(View,Boolean).
When an element is set to hidden, it will be replaced by a "Hidden" placeholder in the replay, and its child views will not be recorded.
Note: Marking a view as hidden does not prevent touch interactions on that element from being recorded. To hide touch interactions, in addition to marking the element as hidden, also use Touch Override.
Webview Session Replay¶
Supported in
ft-session-replay0.1.3-alpha11,ft-sdk1.7.0-alpha36 and above.
WebView Session Replay requires integrating the Web Monitoring SDK into the WebView accessed page and enabling Session Replay in the Webview.
Tencent Webivew X5 Support¶
Jetpack Compose Support¶
Currently, Session Replay recording for Jetpack Compose related interfaces is not supported.