Skip to content

Commit f408b4a

Browse files
author
AR Abdul Azeez
committed
ANR simulation
1 parent 7d02427 commit f408b4a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

examples/demo/app/src/main/java/com/onesignal/sdktest/ui/secondary/SecondaryActivity.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ class SecondaryActivity : ComponentActivity() {
7777
text = "CRASH",
7878
onClick = { triggerCrash() }
7979
)
80+
81+
Spacer(modifier = Modifier.height(16.dp))
82+
83+
DestructiveButton(
84+
text = "SIMULATE ANR (10s block)",
85+
onClick = { triggerAnr() }
86+
)
8087
}
8188
}
8289
}
@@ -88,4 +95,9 @@ class SecondaryActivity : ComponentActivity() {
8895
.format(Date())
8996
throw RuntimeException("Test crash from OneSignal Demo App - $timestamp")
9097
}
98+
99+
@Suppress("MagicNumber")
100+
private fun triggerAnr() {
101+
Thread.sleep(10_000)
102+
}
91103
}

0 commit comments

Comments
 (0)