Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions sdk/@launchdarkly/observability-android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,9 @@ Use `ldMask()` to mark views that should be masked in session replay. There are
Import the masking API and call `ldMask()` on any `View` (for example, after inflating the layout in an `Activity` or `Fragment`).

```kotlin
import android.os.Bundle
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import com.launchdarkly.observability.api.ldMask

class LoginActivity : AppCompatActivity() {
class LoginActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
Expand All @@ -197,18 +194,18 @@ class LoginActivity : AppCompatActivity() {
With View Binding or Data Binding:

```kotlin
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.launchdarkly.observability.api.ldMask

class CheckoutFragment : Fragment(R.layout.fragment_checkout) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val binding = FragmentCheckoutBinding.bind(view)
binding.creditCardNumber.ldMask()
binding.cvv.ldMask()
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
_binding = SettingsPageBinding.inflate(inflater, container, false)
binding.nestedScrollView.systemBarsPadding()
viewModel.toggleBackgroundAccess(requireContext().isIgnoreBatteryEnabled())
val toolbar = binding.toolbar
toolbar.ldMask()
}
```

Expand All @@ -219,21 +216,21 @@ Optional: use `ldUnmask()` to explicitly clear masking on a view you previously
Add the masking `Modifier` to any composable you want masked in session replay.

```kotlin
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.TextField
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import com.launchdarkly.observability.api.ldMask

@Composable
fun CreditCardField() {
var number by remember { mutableStateOf("") }
TextField(
value = number,
onValueChange = { number = it },
...
var zipCode by remember { mutableStateOf("") }

OutlinedTextField(
value = zipCode,
onValueChange = { zipCode = it },
label = { Text("ZIP Code") },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
modifier = Modifier
.fillMaxWidth()
.ldMask() // mask this composable in session replay
.ldMask()
)
}
```
Expand Down
Loading