Skip to content

Commit

Permalink
enhance(android): add crash report using sentry.io
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Jan 3, 2024
1 parent 8390c95 commit 9030dd3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ capacitor-cordova-android-plugins

# Copied web assets
app/src/main/assets/public

# Sentry Config File
sentry.properties
16 changes: 16 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

plugins {
id 'io.sentry.android.gradle' version '4.1.1'
}

apply plugin: 'com.android.application'

android {
Expand All @@ -15,6 +20,7 @@ android {
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
manifestPlaceholders = [LOGSEQ_SENTRY_DSN: "$System.env.LOGSEQ_SENTRY_DSN"]
}
buildTypes {
release {
Expand Down Expand Up @@ -53,3 +59,13 @@ try {
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}


sentry {
org = "logseq"
projectName = "logseq"

// this will upload your source code to Sentry to show it as part of the stack traces
// disable if you don't want to expose your sources
includeSourceContext = false
}
17 changes: 16 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,20 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${LOGSEQ_SENTRY_DSN}" />

<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
<!-- enable screenshot for crashes (could contain sensitive/PII data) -->
<meta-data android:name="io.sentry.attach-screenshot" android:value="true" />
<!-- enable view hierarchy for crashes -->
<meta-data android:name="io.sentry.attach-view-hierarchy" android:value="true" />

<!-- enable the performance API by setting a sample-rate, adjust in production env -->
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
<!-- enable profiling when starting transactions, adjust in production env -->
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1.0" />
</application>
</manifest>

0 comments on commit 9030dd3

Please sign in to comment.