Issue #9: Add crash reporting via Mozilla's sentry instance.

Sebastian Kaspari 6 years ago
parent f2914ffd97
commit ff55105fab

@ -29,13 +29,28 @@ android {
}
dependencies {
implementation 'io.sentry:sentry-android:1.7.3'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
// -------------------------------------------------------------------------------------------------
// -- Sentry
// -------------------------------------------------------------------------------------------------
android.applicationVariants.all {
try {
def token = new File("${rootDir}/.sentry").text.trim()
buildConfigField 'String', 'SENTRY_TOKEN', '"' + token + '"'
} catch (FileNotFoundException ignored) {
buildConfigField 'String', 'SENTRY_TOKEN', 'null'
}
}

@ -2,13 +2,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mozilla.fenix">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:name=".FenixApplication">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -16,6 +20,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,23 @@
/* 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 mozilla.fenix
import android.app.Application
import io.sentry.Sentry
import io.sentry.android.AndroidSentryClientFactory
class FenixApplication : Application() {
override fun onCreate() {
super.onCreate()
initializeCrashReporting()
}
private fun initializeCrashReporting() {
if (BuildConfig.SENTRY_TOKEN != null) {
Sentry.init(BuildConfig.SENTRY_TOKEN, AndroidSentryClientFactory(this))
}
}
}
Loading…
Cancel
Save