Skip to content

Commit

Permalink
add acra to send crash reports
Browse files Browse the repository at this point in the history
  • Loading branch information
sdex committed Sep 15, 2022
1 parent 2b6d2f6 commit 0449f77
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ dependencies {
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.vectordrawable:vectordrawable:1.1.0"
def acra_version = "5.9.6"
implementation "ch.acra:acra-mail:$acra_version"
implementation "ch.acra:acra-dialog:$acra_version"
def glide_version = "4.13.2"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import android.content.Context
import androidx.multidex.MultiDex
import com.sdex.activityrunner.preferences.AppPreferences
import dagger.hilt.android.HiltAndroidApp
import org.acra.ReportField
import org.acra.config.dialog
import org.acra.config.mailSender
import org.acra.data.StringFormat
import org.acra.ktx.initAcra
import timber.log.Timber

@HiltAndroidApp
Expand All @@ -23,5 +28,28 @@ class ActivityManagerApplication : Application() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)

initAcra {
buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON
reportContent = listOf(
ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.ANDROID_VERSION,
ReportField.PHONE_MODEL,
ReportField.STACK_TRACE,
)
mailSender {
mailTo = "[email protected]"
subject = "Activity Manager crash report"
}
dialog {
title = "Crash report"
text = "App crashed. Do you want to send the email report?"
resTheme = R.style.AppDialogTheme
positiveButtonText = "Yes"
negativeButtonText = "No"
}
}
}
}

0 comments on commit 0449f77

Please sign in to comment.