From: Damyan Ivanov Date: Wed, 5 Jun 2019 18:27:50 +0000 (+0300) Subject: add MoLe version to the crash report X-Git-Tag: v0.10.1~2 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9444b6123710997425d2f311d5dd97c6590aebca;p=mobile-ledger.git add MoLe version to the crash report --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/CrashReportingActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/CrashReportingActivity.java index 24b50fa7..183a5e91 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/CrashReportingActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/CrashReportingActivity.java @@ -17,18 +17,19 @@ package net.ktnx.mobileledger.ui.activity; +import android.content.pm.PackageInfo; import android.os.Build; import android.os.Bundle; import android.util.Log; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + import net.ktnx.mobileledger.ui.CrashReportDialogFragment; import java.io.PrintWriter; import java.io.StringWriter; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; - import static net.ktnx.mobileledger.utils.Logger.debug; public abstract class CrashReportingActivity extends AppCompatActivity { @@ -42,6 +43,16 @@ public abstract class CrashReportingActivity extends AppCompatActivity { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); + try { + PackageInfo pi = getApplicationContext().getPackageManager() + .getPackageInfo(getPackageName(), 0); + pw.format("MoLe version: %s\n", pi.versionName); + } + catch (Exception oh) { + pw.print("Error getting package version:\n"); + oh.printStackTrace(pw); + pw.print("\n"); + } pw.format("OS version: %s; API level %d\n\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT); e.printStackTrace(pw);