put version code into crash report

This commit is contained in:
Daniel Gultsch 2020-04-25 20:13:20 +02:00
parent c41033e83c
commit 006d7447a3

View file

@ -62,7 +62,10 @@ public class ExceptionHelper {
PackageInfo packageInfo;
try {
packageInfo = pm.getPackageInfo(activity.getPackageName(), PackageManager.GET_SIGNATURES);
report.append("Version: ").append(packageInfo.versionName).append('\n');
final String versionName = packageInfo.versionName;
final int versionCode = packageInfo.versionCode;
final int version = versionCode > 10000 ? (versionCode / 100) : versionCode;
report.append(String.format(Locale.ROOT, "Version: %s(%d)", versionName, version)).append('\n');
report.append("Last Update: ").append(DATE_FORMAT.format(new Date(packageInfo.lastUpdateTime))).append('\n');
Signature[] signatures = packageInfo.signatures;
if (signatures != null && signatures.length >= 1) {