diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-01-09 22:12:17 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-01-09 22:12:17 -0800 |
commit | 520771a755ea1939622b5e2f92ca0968c7564b13 (patch) | |
tree | 139e4e98ade3749d3e8fb0f55cfb7cabb3411e26 | |
parent | bb306613db81c419bd74f52b3c37611d140d099a (diff) | |
download | dsub-520771a755ea1939622b5e2f92ca0968c7564b13.tar.gz dsub-520771a755ea1939622b5e2f92ca0968c7564b13.tar.bz2 dsub-520771a755ea1939622b5e2f92ca0968c7564b13.zip |
Include version in subject of logs
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/MainActivity.java | 83 |
1 files changed, 43 insertions, 40 deletions
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<File>(this, false) { - @Override - protected File doInBackground() throws Throwable { - updateProgress("Gathering Logs"); - File logcat = new File(FileUtil.getSubsonicDirectory(), "logcat.txt"); - Process logcatProc = null; - - try { - List<String> progs = new ArrayList<String>(); - 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<File>(this, false) { + @Override + protected File doInBackground() throws Throwable { + updateProgress("Gathering Logs"); + File logcat = new File(FileUtil.getSubsonicDirectory(), "logcat.txt"); + Process logcatProc = null; + + try { + List<String> progs = new ArrayList<String>(); + 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 |