Issue #267: Integrate lib-crash component and upload crash reports to sentry and socorro.
parent
e7ebd712c6
commit
d5515c9f6e
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||||
|
<lint>
|
||||||
|
<issue id="InvalidPackage">
|
||||||
|
<!-- The Sentry SDK is compiled against parts of the Java SDK that are not available in the Android SDK.
|
||||||
|
Let's just ignore issues in the Sentry code since that is a third-party dependency anyways. -->
|
||||||
|
<ignore path="**/sentry*.jar" />
|
||||||
|
</issue>
|
||||||
|
</lint>
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix.components
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import mozilla.components.lib.crash.CrashReporter
|
||||||
|
import mozilla.components.lib.crash.service.MozillaSocorroService
|
||||||
|
import mozilla.components.lib.crash.service.SentryService
|
||||||
|
import org.mozilla.fenix.BuildConfig
|
||||||
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.geckoview.BuildConfig.MOZ_APP_BUILDID
|
||||||
|
import org.mozilla.geckoview.BuildConfig.MOZ_APP_VERSION
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component group for all functionality related to analytics e.g. crash reporting and telemetry.
|
||||||
|
*/
|
||||||
|
class Analytics(
|
||||||
|
private val context: Context
|
||||||
|
) {
|
||||||
|
val crashReporter: CrashReporter by lazy {
|
||||||
|
val sentryService = SentryService(
|
||||||
|
context,
|
||||||
|
BuildConfig.SENTRY_TOKEN,
|
||||||
|
tags = mapOf("geckoview" to "$MOZ_APP_VERSION-$MOZ_APP_BUILDID"),
|
||||||
|
sendEventForNativeCrashes = true
|
||||||
|
)
|
||||||
|
|
||||||
|
val socorroService = MozillaSocorroService(context, "Fenix")
|
||||||
|
|
||||||
|
CrashReporter(
|
||||||
|
services = listOf(sentryService, socorroService),
|
||||||
|
shouldPrompt = CrashReporter.Prompt.ALWAYS,
|
||||||
|
promptConfiguration = CrashReporter.PromptConfiguration(
|
||||||
|
appName = context.getString(R.string.app_name),
|
||||||
|
organizationName = "Mozilla"
|
||||||
|
),
|
||||||
|
enabled = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue