Skip to content

Commit f66ec63

Browse files
authored
Enable more sentry features (#457)
1 parent 77809c9 commit f66ec63

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

android/app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ sentry {
126126
projectName.set("hackernews-android")
127127

128128
ignoredVariants.set(listOf("debug", "fast"))
129+
130+
autoInstallation.sentryVersion.set("8.12.0")
129131
}
130132

131133
dependencies {

android/app/src/main/AndroidManifest.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,61 @@
3131
android:name="io.sentry.dsn"
3232
android:value="https://db2524adf3fee320562f372d15f98098@o497846.ingest.us.sentry.io/4506028523388928" />
3333

34+
<!-- add breadcrumbs for user interactions (clicks, swipes, scrolls) -->
35+
<meta-data
36+
android:name="io.sentry.traces.user-interaction.enable"
37+
android:value="true"
38+
/>
39+
40+
<!-- attach screenshot on crash -->
41+
<meta-data
42+
android:name="io.sentry.attach-screenshot"
43+
android:value="true"
44+
/>
45+
46+
<!-- attach view hierarchy on crash -->
47+
<meta-data
48+
android:name="io.sentry.attach-view-hierarchy"
49+
android:value="true"
50+
/>
51+
52+
<!-- enable traces -->
53+
<meta-data
54+
android:name="io.sentry.traces.sample-rate"
55+
android:value="1.0"
56+
/>
57+
58+
<!-- Enable UI profiling -->
59+
<meta-data
60+
android:name="io.sentry.traces.profiling.session-sample-rate"
61+
android:value="1.0"
62+
/>
63+
<meta-data
64+
android:name="io.sentry.traces.profiling.lifecycle"
65+
android:value="trace"
66+
/>
67+
<!-- Enable profiling on app start. The app start profile will be stopped automatically when the app start root span finishes -->
68+
<meta-data
69+
android:name="io.sentry.traces.profiling.start-on-app-start"
70+
android:value="true"
71+
/>
72+
73+
<!-- record session replays -->
74+
<meta-data
75+
android:name="io.sentry.session-replay.on-error-sample-rate"
76+
android:value="1.0"
77+
/>
78+
<meta-data
79+
android:name="io.sentry.session-replay.session-sample-rate"
80+
android:value="0.1"
81+
/>
82+
83+
<!-- enable logs -->
84+
<meta-data
85+
android:name="io.sentry.logs.enabled"
86+
android:value="true"
87+
/>
88+
3489
<activity
3590
android:name=".MainActivity"
3691
android:exported="true"

android/app/src/main/java/com/emergetools/hackernews/HackerNewsApplication.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.emergetools.hackernews.data.remote.HackerNewsBaseClient
1414
import com.emergetools.hackernews.data.remote.HackerNewsSearchClient
1515
import com.emergetools.hackernews.data.remote.HackerNewsWebClient
1616
import com.emergetools.reaper.Reaper
17+
import io.sentry.Sentry
1718
import kotlinx.serialization.json.Json
1819
import okhttp3.OkHttpClient
1920
import java.time.Duration
@@ -32,6 +33,8 @@ class HackerNewsApplication : Application() {
3233
override fun onCreate() {
3334
super.onCreate()
3435

36+
Sentry.logger().info("HackerNewsApplication#onCreate")
37+
3538
// This demonstrates manual initialization of Reaper.
3639
// See https://docs.emergetools.com/docs/reaper-setup-android#manual-initialization
3740
Reaper.init(applicationContext)

0 commit comments

Comments
 (0)