diff --git a/document-viewer/build.gradle b/document-viewer/build.gradle index 756c69725..b89481572 100644 --- a/document-viewer/build.gradle +++ b/document-viewer/build.gradle @@ -3,6 +3,7 @@ apply plugin: 'com.android.application' dependencies { compile 'jcifs:jcifs:1.3.17' compile 'com.android.support:support-v4:24.1.1' + compile 'ch.acra:acra:4.9.0' } import java.util.regex.Pattern diff --git a/document-viewer/src/main/java/org/ebookdroid/EBookDroidApp.java b/document-viewer/src/main/java/org/ebookdroid/EBookDroidApp.java index db025edcb..e53a62ef0 100644 --- a/document-viewer/src/main/java/org/ebookdroid/EBookDroidApp.java +++ b/document-viewer/src/main/java/org/ebookdroid/EBookDroidApp.java @@ -1,5 +1,8 @@ package org.ebookdroid; +import org.acra.ACRA; +import org.acra.ReportingInteractionMode; +import org.acra.annotation.ReportsCrashes; import org.ebookdroid.common.bitmaps.BitmapManager; import org.ebookdroid.common.bitmaps.ByteBufferManager; import org.ebookdroid.common.cache.CacheManager; @@ -27,6 +30,11 @@ import org.emdev.utils.concurrent.Flag; import org.sufficientlysecure.viewer.R; +@ReportsCrashes(mailTo = "fixme", + mode = ReportingInteractionMode.DIALOG, + resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, + resDialogText = R.string.crash_dialog_text, + resDialogTitle = R.string.crash_dialog_title) public class EBookDroidApp extends BaseDroidApp implements IAppSettingsChangeListener, IBackupSettingsChangeListener, ILibSettingsChangeListener { @@ -159,4 +167,11 @@ private static Object preallocateHeap(final int size) { return null; } + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + + // The following line triggers the initialization of ACRA + ACRA.init(this); + } } diff --git a/document-viewer/src/main/res/values/strings_common.xml b/document-viewer/src/main/res/values/strings_common.xml index 703eef114..59b7f39c5 100644 --- a/document-viewer/src/main/res/values/strings_common.xml +++ b/document-viewer/src/main/res/values/strings_common.xml @@ -154,4 +154,10 @@ Moving cached files %1$d/%2$d This action is only available in view mode %1$s + + Document Viewer has crashed + An unexpected error occurred + forcing the application to stop. Would you like to e-mail the + details to help fix the issue? + You can add extra information and comments here: \ No newline at end of file