@@ -167,7 +167,82 @@ span.makeCurrent().use {
167167span.end()
168168```
169169
170+ ### Session Replay
170171
172+ #### Masking sensitive UI
173+
174+ Use ` ldMask() ` to mark views that should be masked in session replay. There are helpers for both XML-based Views and Jetpack Compose.
175+
176+ ##### XML Views
177+
178+ Import the masking API and call ` ldMask() ` on any ` View ` (for example, after inflating the layout in an ` Activity ` or ` Fragment ` ).
179+
180+ ``` kotlin
181+ import android.os.Bundle
182+ import android.widget.EditText
183+ import androidx.appcompat.app.AppCompatActivity
184+ import com.launchdarkly.observability.api.ldMask
185+
186+ class LoginActivity : AppCompatActivity () {
187+ override fun onCreate (savedInstanceState : Bundle ? ) {
188+ super .onCreate(savedInstanceState)
189+ setContentView(R .layout.activity_login)
190+
191+ val password = findViewById<EditText >(R .id.password)
192+ password.ldMask() // mask this field in session replay
193+ }
194+ }
195+ ```
196+
197+ With View Binding or Data Binding:
198+
199+ ``` kotlin
200+ import android.os.Bundle
201+ import android.view.View
202+ import androidx.fragment.app.Fragment
203+ import com.launchdarkly.observability.api.ldMask
204+
205+ class CheckoutFragment : Fragment (R .layout.fragment_checkout) {
206+ override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
207+ super .onViewCreated(view, savedInstanceState)
208+ val binding = FragmentCheckoutBinding .bind(view)
209+ binding.creditCardNumber.ldMask()
210+ binding.cvv.ldMask()
211+ }
212+ }
213+ ```
214+
215+ Optional: use ` ldUnmask() ` to explicitly clear masking on a view you previously masked.
216+
217+ ##### Jetpack Compose
218+
219+ Add the masking ` Modifier ` to any composable you want masked in session replay.
220+
221+ ``` kotlin
222+ import androidx.compose.foundation.layout.fillMaxWidth
223+ import androidx.compose.material3.TextField
224+ import androidx.compose.runtime.*
225+ import androidx.compose.ui.Modifier
226+ import com.launchdarkly.observability.api.ldMask
227+
228+ @Composable
229+ fun CreditCardField () {
230+ var number by remember { mutableStateOf(" " ) }
231+ TextField (
232+ value = number,
233+ onValueChange = { number = it },
234+ modifier = Modifier
235+ .fillMaxWidth()
236+ .ldMask() // mask this composable in session replay
237+ )
238+ }
239+ ```
240+
241+ Optional: use ` Modifier.ldUnmask() ` to explicitly clear masking on a composable you previously masked.
242+
243+ Notes:
244+ - Masking marks elements so their contents are obscured in recorded sessions.
245+ - You can apply masking to any ` View ` or composable where sensitive data may appear.
171246
172247## Contributing
173248
0 commit comments