aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-24 12:33:56 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-24 12:33:56 +0200
commitc7c3db478ad7212d3b66cf83c702cd60004ff53a (patch)
tree07b080f68c36adb3d0d0fccbe704e6dde453b66a /src/eu/siacs
parent438538e2da35379fd8ebd9cd6d64914e345d92cf (diff)
included version string in crash reports
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/utils/ExceptionHelper.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/utils/ExceptionHelper.java b/src/eu/siacs/conversations/utils/ExceptionHelper.java
index 05b16240..373aadd3 100644
--- a/src/eu/siacs/conversations/utils/ExceptionHelper.java
+++ b/src/eu/siacs/conversations/utils/ExceptionHelper.java
@@ -17,7 +17,11 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.DialogInterface.OnClickListener;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;
+import android.text.format.DateUtils;
import android.util.Log;
public class ExceptionHelper {
@@ -49,13 +53,20 @@ public class ExceptionHelper {
FileInputStream file = context.openFileInput("stacktrace.txt");
InputStreamReader inputStreamReader = new InputStreamReader(
file);
- BufferedReader bufferedReader = new BufferedReader(
+ BufferedReader stacktrace = new BufferedReader(
inputStreamReader);
- final StringBuilder stacktrace = new StringBuilder();
+ final StringBuilder report = new StringBuilder();
+ PackageManager pm = context.getPackageManager();
+ PackageInfo packageInfo = null;
+ try {
+ packageInfo = pm.getPackageInfo(context.getPackageName(), 0);
+ report.append("Version: "+packageInfo.versionName+'\n');
+ report.append("Last Update: "+DateUtils.formatDateTime(context, packageInfo.lastUpdateTime, DateUtils.FORMAT_SHOW_TIME|DateUtils.FORMAT_SHOW_DATE)+'\n');
+ } catch (NameNotFoundException e) {}
String line;
- while((line = bufferedReader.readLine()) != null) {
- stacktrace.append(line);
- stacktrace.append('\n');
+ while((line = stacktrace.readLine()) != null) {
+ report.append(line);
+ report.append('\n');
}
file.close();
context.deleteFile("stacktrace.txt");
@@ -69,7 +80,7 @@ public class ExceptionHelper {
Log.d("xmppService","using account="+finalAccount.getJid()+" to send in stack trace");
Conversation conversation = service.findOrCreateConversation(finalAccount, "bugs@siacs.eu", false);
- Message message = new Message(conversation, stacktrace.toString(), Message.ENCRYPTION_NONE);
+ Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE);
service.sendMessage(message);
}
});