Skip to content

Commit dd90a8f

Browse files
0xadam-brownOpenCode
andcommitted
feat(android): Add MemoryLimiter sample (JAVA-687)
Introduce a MemoryLimiter sample so that developers can verify the functionality of the recently-introduced MemoryLimiterIntegration. Co-Authored-By: OpenCode <noreply@example.com>
1 parent cfde326 commit dd90a8f

3 files changed

Lines changed: 542 additions & 0 deletions

File tree

‎sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@
132132
android:name=".sqlite.UiLoadActivity"
133133
android:exported="false" />
134134

135+
<activity
136+
android:name=".memory.MemoryLimiterActivity"
137+
android:exported="false"
138+
android:theme="@style/AppTheme.Main" />
139+
135140
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard-->
136141
<meta-data
137142
android:name="io.sentry.dsn"
@@ -318,6 +323,9 @@
318323
<meta-data
319324
android:name="io.sentry.tombstone.enable"
320325
android:value="true" />
326+
<meta-data
327+
android:name="io.sentry.memory-limiter.enable"
328+
android:value="true" />
321329
<meta-data
322330
android:name="io.sentry.anr.profiling.sample-rate"
323331
android:value="1.0" />

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/MainActivity.kt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ import io.sentry.android.core.SentryUserFeedbackForm
9191
import io.sentry.compose.SentryTraced
9292
import io.sentry.protocol.Feedback
9393
import io.sentry.protocol.User
94+
import io.sentry.samples.android.memory.MemoryLimiterActivity
9495
import java.io.File
9596
import java.io.FileOutputStream
9697
import java.io.IOException
@@ -984,6 +985,19 @@ fun IntegrationsScreen() {
984985
}
985986
}
986987
}
988+
item {
989+
SentryTraced("memory_limiter") {
990+
OutlinedButton(
991+
onClick = {
992+
tagSampleAction("memory_limiter")
993+
activity.startActivity(Intent(activity, MemoryLimiterActivity::class.java))
994+
},
995+
modifier = Modifier,
996+
) {
997+
Text("MemoryLimiter Demo", maxLines = 2, overflow = TextOverflow.Ellipsis)
998+
}
999+
}
1000+
}
9871001
item {
9881002
SentryTraced("throw_in_coroutine") {
9891003
OutlinedButton(onClick = { CoroutinesUtil.throwInCoroutine() }, modifier = Modifier) {

0 commit comments

Comments
 (0)