diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-05 20:12:20 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2020-02-05 20:12:20 +0100 |
commit | 3741aee8157039493126d38ce1e59e235720a6f9 (patch) | |
tree | 55337b8be439d23bdb15b111c46b4447c86aa92b /src | |
parent | 3c3c645c68552c1c074650ce370a720e67c9ecf0 (diff) |
add device to crash report
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/ExceptionHelper.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java index 8d59c83bf..834f83cea 100644 --- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java @@ -62,8 +62,10 @@ public class ExceptionHelper { PackageInfo packageInfo; String release = Build.VERSION.RELEASE; int sdkVersion = Build.VERSION.SDK_INT; + String deviceName = getDeviceName(); try { packageInfo = pm.getPackageInfo(activity.getPackageName(), PackageManager.GET_SIGNATURES); + report.append("Device: ").append(deviceName).append('\n'); report.append("Android SDK: ").append(sdkVersion).append(" (").append(release).append(")").append('\n'); report.append("Version: ").append(packageInfo.versionName).append('\n'); report.append("Last Update: ").append(DATE_FORMAT.format(new Date(packageInfo.lastUpdateTime))).append('\n'); @@ -100,6 +102,16 @@ public class ExceptionHelper { } } + public static String getDeviceName() { + String manufacturer = Build.MANUFACTURER; + String model = Build.MODEL; + if (model.startsWith(manufacturer)) { + return model; + } else { + return manufacturer + " " + model; + } + } + static void writeToStacktraceFile(Context context, String msg) { try { OutputStream os = context.openFileOutput(FILENAME, Context.MODE_PRIVATE); |