Skip to content

Commit

Permalink
chore(android): record a sample session with user ID (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaysood authored Mar 7, 2025
1 parent 22b763b commit deec73b
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ class ExceptionDemoActivity : AppCompatActivity() {
}
}
}
val switch = findViewById<SwitchMaterial>(R.id.btn_sdk_switch)
switch.isChecked = true
switch.setOnCheckedChangeListener { _, isChecked ->
val sdkSwitch = findViewById<SwitchMaterial>(R.id.btn_sdk_switch)
sdkSwitch.isChecked = true
sdkSwitch.setOnCheckedChangeListener { _, isChecked ->
when (isChecked) {
true -> {
Measure.start()
Expand All @@ -166,6 +166,22 @@ class ExceptionDemoActivity : AppCompatActivity() {
}
}
}

val userSwitch = findViewById<SwitchMaterial>(R.id.switch_set_user)
userSwitch.isChecked = false
userSwitch.setOnCheckedChangeListener { _, isChecked ->
when (isChecked) {
true -> {
Measure.setUserId("dummy-user-id")
}

false -> {
Measure.clearUserId()
}
}
}


span.setStatus(SpanStatus.Ok).end()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,15 @@
android:text="@string/create_span"
app:drawableEndCompat="@drawable/ic_chevron_right" />


<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch_set_user"
style="@style/Widget.Material3.TextView.SettingsItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/set_user"
app:switchPadding="16dp" />

</LinearLayout>
</com.google.android.material.card.MaterialCardView>

Expand Down
1 change: 1 addition & 0 deletions android/sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
<string name="bug_report">Bug reports</string>
<string name="enable_shake">Enable shake to report</string>
<string name="custom_shake_handler">Custom shake handler</string>
<string name="set_user">Set User</string>
</resources>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="151" width="1344" height="4290"/><rect x="48" y="199" width="1248" height="153"/><rect y="497" width="1344" height="672"/><rect y="497" width="1344" height="168" class="target-rect"/><rect y="665" width="1344" height="168"/><rect y="833" width="1344" height="168"/><rect y="1001" width="1344" height="168"/><rect y="1290" width="1344" height="336"/><rect y="1290" width="1344" height="168"/><rect y="1458" width="1344" height="168"/><rect y="1747" width="1344" height="840"/><rect y="1747" width="1344" height="168"/><rect y="1915" width="1344" height="168"/><rect y="2083" width="1344" height="168"/><rect y="2251" width="1344" height="168"/><rect y="2419" width="1344" height="168"/><rect y="2708" width="1344" height="336"/><rect y="2708" width="1344" height="168"/><rect y="2876" width="1344" height="168"/><rect y="3165" width="1344" height="642"/><rect y="3165" width="1344" height="153"/><rect y="3318" width="1344" height="153"/><rect y="3471" width="1344" height="168"/><rect y="3639" width="1344" height="168"/><rect y="3928" width="1344" height="489"/><rect y="3928" width="1344" height="168"/><rect y="4096" width="1344" height="168"/><rect y="4264" width="1344" height="153"/></g><g class="text-rect"><rect y="400" width="1344" height="73"/><rect y="1193" width="1344" height="73"/><rect y="1650" width="1344" height="73"/><rect y="2611" width="1344" height="73"/><rect y="3068" width="1344" height="73"/><rect y="3831" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="151" width="1344" height="4290"/><rect x="48" y="199" width="1248" height="153"/><rect y="497" width="1344" height="672"/><rect y="497" width="1344" height="168"/><rect y="665" width="1344" height="168"/><rect y="833" width="1344" height="168"/><rect y="1001" width="1344" height="168"/><rect y="1290" width="1344" height="336"/><rect y="1290" width="1344" height="168"/><rect y="1458" width="1344" height="168"/><rect y="1747" width="1344" height="840"/><rect y="1747" width="1344" height="168" class="target-rect"/><rect y="1915" width="1344" height="168"/><rect y="2083" width="1344" height="168"/><rect y="2251" width="1344" height="168"/><rect y="2419" width="1344" height="168"/><rect y="2708" width="1344" height="336"/><rect y="2708" width="1344" height="168"/><rect y="2876" width="1344" height="168"/><rect y="3165" width="1344" height="642"/><rect y="3165" width="1344" height="153"/><rect y="3318" width="1344" height="153"/><rect y="3471" width="1344" height="168"/><rect y="3639" width="1344" height="168"/><rect y="3928" width="1344" height="489"/><rect y="3928" width="1344" height="168"/><rect y="4096" width="1344" height="168"/><rect y="4264" width="1344" height="153"/></g><g class="text-rect"><rect y="400" width="1344" height="73"/><rect y="1193" width="1344" height="73"/><rect y="1650" width="1344" height="73"/><rect y="2611" width="1344" height="73"/><rect y="3068" width="1344" height="73"/><rect y="3831" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="-1370" width="1344" height="4290"/><rect x="48" y="-1322" width="1248" height="153"/><rect y="-1024" width="1344" height="672"/><rect y="-1024" width="1344" height="168"/><rect y="-856" width="1344" height="168"/><rect y="-688" width="1344" height="168"/><rect y="-520" width="1344" height="168"/><rect y="-231" width="1344" height="336"/><rect y="-231" width="1344" height="168"/><rect y="-63" width="1344" height="168"/><rect y="226" width="1344" height="840"/><rect y="226" width="1344" height="168"/><rect y="394" width="1344" height="168"/><rect y="562" width="1344" height="168"/><rect y="730" width="1344" height="168"/><rect y="898" width="1344" height="168"/><rect y="1187" width="1344" height="336"/><rect y="1187" width="1344" height="168"/><rect y="1355" width="1344" height="168"/><rect y="1644" width="1344" height="642"/><rect y="1644" width="1344" height="153"/><rect y="1797" width="1344" height="153"/><rect y="1950" width="1344" height="168"/><rect y="2118" width="1344" height="168"/><rect y="2407" width="1344" height="489"/><rect y="2407" width="1344" height="168"/><rect y="2575" width="1344" height="168" class="target-rect"/><rect y="2743" width="1344" height="153"/></g><g class="text-rect"><rect y="-1121" width="1344" height="73"/><rect y="-328" width="1344" height="73"/><rect y="129" width="1344" height="73"/><rect y="1090" width="1344" height="73"/><rect y="1547" width="1344" height="73"/><rect y="2310" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="-1370" width="1344" height="4290"/><rect x="48" y="-1322" width="1248" height="153"/><rect y="-1024" width="1344" height="672"/><rect y="-1024" width="1344" height="168"/><rect y="-856" width="1344" height="168"/><rect y="-688" width="1344" height="168"/><rect y="-520" width="1344" height="168"/><rect y="-231" width="1344" height="336"/><rect y="-231" width="1344" height="168"/><rect y="-63" width="1344" height="168"/><rect y="226" width="1344" height="840"/><rect y="226" width="1344" height="168"/><rect y="394" width="1344" height="168"/><rect y="562" width="1344" height="168"/><rect y="730" width="1344" height="168"/><rect y="898" width="1344" height="168"/><rect y="1187" width="1344" height="336"/><rect y="1187" width="1344" height="168"/><rect y="1355" width="1344" height="168"/><rect y="1644" width="1344" height="642"/><rect y="1644" width="1344" height="153"/><rect y="1797" width="1344" height="153"/><rect y="1950" width="1344" height="168"/><rect y="2118" width="1344" height="168"/><rect y="2407" width="1344" height="489"/><rect y="2407" width="1344" height="168"/><rect y="2575" width="1344" height="168"/><rect y="2743" width="1344" height="153" class="target-rect"/></g><g class="text-rect"><rect y="-1121" width="1344" height="73"/><rect y="-328" width="1344" height="73"/><rect y="129" width="1344" height="73"/><rect y="1090" width="1344" height="73"/><rect y="1547" width="1344" height="73"/><rect y="2310" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="-1370" width="1344" height="4290"/><rect x="48" y="-1322" width="1248" height="153"/><rect y="-1024" width="1344" height="672"/><rect y="-1024" width="1344" height="168"/><rect y="-856" width="1344" height="168"/><rect y="-688" width="1344" height="168"/><rect y="-520" width="1344" height="168"/><rect y="-231" width="1344" height="336"/><rect y="-231" width="1344" height="168"/><rect y="-63" width="1344" height="168"/><rect y="226" width="1344" height="840"/><rect y="226" width="1344" height="168"/><rect y="394" width="1344" height="168"/><rect y="562" width="1344" height="168"/><rect y="730" width="1344" height="168"/><rect y="898" width="1344" height="168"/><rect y="1187" width="1344" height="336"/><rect y="1187" width="1344" height="168"/><rect y="1355" width="1344" height="168"/><rect y="1644" width="1344" height="642"/><rect y="1644" width="1344" height="153"/><rect y="1797" width="1344" height="153"/><rect y="1950" width="1344" height="168"/><rect y="2118" width="1344" height="168"/><rect y="2407" width="1344" height="489"/><rect y="2407" width="1344" height="168"/><rect y="2575" width="1344" height="168"/><rect y="2743" width="1344" height="153" class="target-rect"/></g><g class="text-rect"><rect y="-1121" width="1344" height="73"/><rect y="-328" width="1344" height="73"/><rect y="129" width="1344" height="73"/><rect y="1090" width="1344" height="73"/><rect y="1547" width="1344" height="73"/><rect y="2310" width="1344" height="73"/></g></g></svg>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="-1370" width="1344" height="4290"/><rect x="48" y="-1322" width="1248" height="153"/><rect y="-1024" width="1344" height="672"/><rect y="-1024" width="1344" height="168"/><rect y="-856" width="1344" height="168"/><rect y="-688" width="1344" height="168"/><rect y="-520" width="1344" height="168"/><rect y="-231" width="1344" height="336"/><rect y="-231" width="1344" height="168"/><rect y="-63" width="1344" height="168"/><rect y="226" width="1344" height="840"/><rect y="226" width="1344" height="168"/><rect y="394" width="1344" height="168"/><rect y="562" width="1344" height="168"/><rect y="730" width="1344" height="168"/><rect y="898" width="1344" height="168"/><rect y="1187" width="1344" height="336"/><rect y="1187" width="1344" height="168"/><rect y="1355" width="1344" height="168"/><rect y="1644" width="1344" height="642"/><rect y="1644" width="1344" height="153"/><rect y="1797" width="1344" height="153"/><rect y="1950" width="1344" height="168"/><rect y="2118" width="1344" height="168"/><rect y="2407" width="1344" height="489"/><rect y="2407" width="1344" height="168"/><rect y="2575" width="1344" height="168"/><rect y="2743" width="1344" height="153" class="target-rect"/></g><g class="text-rect"><rect y="-1121" width="1344" height="73"/><rect y="-328" width="1344" height="73"/><rect y="129" width="1344" height="73"/><rect y="1090" width="1344" height="73"/><rect y="1547" width="1344" height="73"/><rect y="2310" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect y="151" width="1344" height="4290"/><rect x="48" y="199" width="1248" height="153"/><rect y="497" width="1344" height="672"/><rect y="497" width="1344" height="168"/><rect y="665" width="1344" height="168"/><rect y="833" width="1344" height="168"/><rect y="1001" width="1344" height="168"/><rect y="1290" width="1344" height="336"/><rect y="1290" width="1344" height="168"/><rect y="1458" width="1344" height="168"/><rect y="1747" width="1344" height="840"/><rect y="1747" width="1344" height="168"/><rect y="1915" width="1344" height="168" class="target-rect"/><rect y="2083" width="1344" height="168"/><rect y="2251" width="1344" height="168"/><rect y="2419" width="1344" height="168"/><rect y="2708" width="1344" height="336"/><rect y="2708" width="1344" height="168"/><rect y="2876" width="1344" height="168"/><rect y="3165" width="1344" height="642"/><rect y="3165" width="1344" height="153"/><rect y="3318" width="1344" height="153"/><rect y="3471" width="1344" height="168"/><rect y="3639" width="1344" height="168"/><rect y="3928" width="1344" height="489"/><rect y="3928" width="1344" height="168"/><rect y="4096" width="1344" height="168"/><rect y="4264" width="1344" height="153"/></g><g class="text-rect"><rect y="400" width="1344" height="73"/><rect y="1193" width="1344" height="73"/><rect y="1650" width="1344" height="73"/><rect y="2611" width="1344" height="73"/><rect y="3068" width="1344" height="73"/><rect y="3831" width="1344" height="73"/></g></g></svg>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1344 2992"><defs><pattern id="d" width="24" height="24" patternTransform="rotate(45)" patternUnits="userSpaceOnUse"><line y1="0" y2="24" stroke="#fef08a" stroke-width="3"/></pattern><linearGradient id="text-gradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:#fef08a;stop-opacity:0.1"/><stop offset="100%" style="stop-color:#fef08a;stop-opacity:0.05"/></linearGradient><style>.base-rect{fill:none}.grey-rect{stroke:#64748b;stroke-width:5}.text-rect{fill:url(#text-gradient)}.target-rect{fill:url(#d);stroke:#fef08a;stroke-width:3}</style></defs><g><rect width="100%" height="100%" fill="#262626"/><g class="base-rect grey-rect"><rect width="1344" height="2992"/><rect width="1344" height="264"/><rect y="264" width="1344" height="264"/><rect y="528" width="1344" height="264"/><rect y="792" width="1344" height="264"/><rect y="1056" width="1344" height="264"/><rect y="1320" width="1344" height="264"/><rect y="1584" width="1344" height="264"/><rect y="1848" width="1344" height="264"/><rect y="2112" width="1344" height="264" class="target-rect"/><rect y="2376" width="1344" height="264"/><rect y="2640" width="1344" height="264"/><rect y="2904" width="1344" height="88"/></g></g></svg>

Large diffs are not rendered by default.

0 comments on commit deec73b

Please sign in to comment.