From 520771a755ea1939622b5e2f92ca0968c7564b13 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 9 Jan 2013 22:12:17 -0800 Subject: Include version in subject of logs --- .../daneren2005/dsub/activity/MainActivity.java | 83 +++++++++++----------- 1 file changed, 43 insertions(+), 40 deletions(-) (limited to 'subsonic-android/src/github') diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java index 755667aa..edd9b779 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java @@ -304,48 +304,51 @@ public class MainActivity extends SubsonicTabActivity { restart(); } - private void getLogs() { - new ModalBackgroundTask(this, false) { - @Override - protected File doInBackground() throws Throwable { - updateProgress("Gathering Logs"); - File logcat = new File(FileUtil.getSubsonicDirectory(), "logcat.txt"); - Process logcatProc = null; - - try { - List progs = new ArrayList(); - progs.add("logcat"); - progs.add("-v"); - progs.add("time"); - progs.add("-d"); - progs.add("-f"); - progs.add(logcat.getPath()); - progs.add("*:I"); - - logcatProc = Runtime.getRuntime().exec(progs.toArray(new String[0])); - logcatProc.waitFor(); - } catch(Exception e) { - Util.toast(MainActivity.this, "Failed to gather logs"); - } finally { - if(logcatProc != null) { - logcatProc.destroy(); + private void getLogs() { + try { + final String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName; + new ModalBackgroundTask(this, false) { + @Override + protected File doInBackground() throws Throwable { + updateProgress("Gathering Logs"); + File logcat = new File(FileUtil.getSubsonicDirectory(), "logcat.txt"); + Process logcatProc = null; + + try { + List progs = new ArrayList(); + progs.add("logcat"); + progs.add("-v"); + progs.add("time"); + progs.add("-d"); + progs.add("-f"); + progs.add(logcat.getPath()); + progs.add("*:I"); + + logcatProc = Runtime.getRuntime().exec(progs.toArray(new String[0])); + logcatProc.waitFor(); + } catch(Exception e) { + Util.toast(MainActivity.this, "Failed to gather logs"); + } finally { + if(logcatProc != null) { + logcatProc.destroy(); + } } + + return logcat; } - return logcat; - } - - @Override - protected void done(File logcat) { - Intent email = new Intent(android.content.Intent.ACTION_SEND); - email.setType("text/plain"); - email.putExtra(Intent.EXTRA_EMAIL, new String[] {"daneren2005@gmail.com"}); - email.putExtra(Intent.EXTRA_SUBJECT, "DSub Error Logs"); - email.putExtra(Intent.EXTRA_TEXT, "Describe the problem here"); - Uri attachment = Uri.fromFile(logcat); - email.putExtra(Intent.EXTRA_STREAM, attachment); - startActivity(email); - } - }.execute(); + @Override + protected void done(File logcat) { + Intent email = new Intent(android.content.Intent.ACTION_SEND); + email.setType("text/plain"); + email.putExtra(Intent.EXTRA_EMAIL, new String[] {"daneren2005@gmail.com"}); + email.putExtra(Intent.EXTRA_SUBJECT, "DSub " + version + " Error Logs"); + email.putExtra(Intent.EXTRA_TEXT, "Describe the problem here"); + Uri attachment = Uri.fromFile(logcat); + email.putExtra(Intent.EXTRA_STREAM, attachment); + startActivity(email); + } + }.execute(); + } catch(Exception e) {} } } \ No newline at end of file -- cgit v1.2.3